Electron-builder: Custom async sign function causes build to fail

Created on 20 Feb 2018  路  2Comments  路  Source: electron-userland/electron-builder

  • Version: 20.0.7
  • Target: mac

I'm using a custom singing function for windows. Since updating to the latest version of electron-builder, the build fails with the following exception:

YAMLException: unacceptable kind of an object to dump [object AsyncFunction]
    at writeNode (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/node_modules/js-yaml/lib/js-yaml/dumper.js:748:13)
    at writeBlockMapping (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/node_modules/js-yaml/lib/js-yaml/dumper.js:627:10)
    at writeNode (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/node_modules/js-yaml/lib/js-yaml/dumper.js:720:9)
    at writeBlockMapping (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/node_modules/js-yaml/lib/js-yaml/dumper.js:627:10)
    at writeNode (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/node_modules/js-yaml/lib/js-yaml/dumper.js:720:9)
    at dump (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/node_modules/js-yaml/lib/js-yaml/dumper.js:809:7)
    at /Users/martin/workspace/padlock/node_modules/electron-builder-lib/src/packager.ts:311:45
From previous event:
    at Packager._build (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/out/packager.js:385:11)
    at /Users/martin/workspace/padlock/node_modules/electron-builder-lib/src/packager.ts:278:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:756:18)
    at tryOnImmediate (timers.js:717:5)
    at processImmediate [as _immediateCallback] (timers.js:697:5)
From previous event:
    at Packager.build (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/out/packager.js:341:11)
    at /Users/martin/workspace/padlock/node_modules/electron-builder-lib/src/index.ts:50:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/martin/workspace/padlock/node_modules/electron-builder-lib/out/index.js:47:21)
    at Object.build (/Users/martin/workspace/padlock/node_modules/electron-builder/src/builder.ts:228:10)
    at rmdir.then.then.then.then.then (/Users/martin/workspace/padlock/lib/build.js:196:29)
    at <anonymous>

My config looks like this (passed as javascript object directly to builder.build:

           {
               ...
                win: {
                    publisherName: "...",
                    sign: async (opts) => {
                        ...
                    }
                },
                ...
            }

It's obvious that the builder is trying to create a yaml dump of the config object without removing any problematic objects. In this case, it's the function that could't get processed.

bug

Most helpful comment

I hope I will fix it today. Thanks for clear report.

All 2 comments

Update: Looks like the YAML library only has problems with async functions. Changing the sign function to a regular function returning a promise solves the problem. Not sure how easy it would be to support async functions in the config. I'm ok without it if it's too much work. In that case, feel free to close this.

I hope I will fix it today. Thanks for clear report.

Was this page helpful?
0 / 5 - 0 ratings