Segfault on start

Hi everyone!

I’ve been trying to create a snap from an electron project using electron builder for quite some time now. (snaps with electron-builder)
When running it immediately terminates with segmentation fault. The code below is a simplified version reproducing the same error.

Everything works fine without the keytar module (and without using the plugs “password-manager-service” and connecting to it and “libsecret-1-0” in stage-packages).
Interestingly even without requiring keytar and just adding “password-manager-service” and “libsecret” the segfault occurs.
The problem seems to be connected to something else though, as the segfault seems to occur in libglib2.0.
From /var/log/syslog:

Apr 16 18:11:28 mT460p kernel: [13973.639143] seg-snap[7683]: segfault at 0 ip 00007f3e94cbe970 sp 
00007fff299405c8 error 4 in libglib-2.0.so.0.4800.2[7f3e94c44000+10f000]

Also, running ./snap/seg-snap/current/app/seg-snap works fine.

Crashes occur also with “devmode”.
The version of electron-builder is 20.8.1 and I’m using Ubuntu 16.04

Having lost quite some hair about this, it would be great if anyone could help me resolving this

Thanks a lot,
Mark

index.js:

const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
//const keytar = require('keytar')

function createWindow () {
    // Create the browser window.
    win = new BrowserWindow({width: 800, height: 600})

    // and load the index.html of the app.
    win.loadURL(url.format({
        pathname: path.join(__dirname, 'index.html'),
        protocol: 'file:',
       slashes: true
   }));
   //keytar.setPassword(app.getName(), "adfadf", "sadfad");
}
app.on('ready', createWindow)

package.json:

{
  "name": "seg-snap",
  "version": "1.0.0",
  "description": "Why is this happening to me",
  "main": "index.js",
  "scripts": {
    "start": "electron .",
    "dist": "electron-builder"
  },
  "author": "Mark",
  "license": "ISC",
  "devDependencies": {
    "@types/keytar": "^4.0.1",
    "electron": "^1.8.4",
    "electron-builder": "^20.8.1",
    "electron-rebuild": "^1.7.3"
  },
  "dependencies": {
    "keytar": "^4.2.1"
  },
  "build": {
    "linux": {
      "target": [
        "snap"
      ]
    },
    "snap": {
      "confinement": "devmode",
      "plugs": [
        "default",
        "password-manager-service"
      ],
      "stagePackages": [
        "default",
        "libsecret-1-0"
      ]
    }
  }
}

index.html:

<html>
     <title>
         So simple, so flawed
     </title>
     <body>
     Seeing this would make me happy
     </body>
</html>