Error in electron-main.js

I migrated from Theia 0.12 to 1.4. If I run theia build, I have an error in my generated electron-main.js:

const setElectronSecurityToken = async port => {
        await electron.session.defaultSession.cookies.set({
            url: `http://localhost:${port}/`,
            name: ElectronSecurityToken,
            value: JSON.stringify(electronSecurityToken),
            httpOnly: true
        });
    };

The set function expects 2 arguments instead of one. Any idea what I forgot to update which might cause this issue?

(node:5419) UnhandledPromiseRejectionWarning: TypeError: Insufficient number of arguments.
    at setElectronSecurityToken (/home/<path>/dist/linux-unpacked/resources/app/src-gen/frontend/electron-main.js:221:55)
    at ChildProcess.cp.on (/home/<path>/dist/linux-unpacked/resources/app/src-gen/frontend/electron-main.js:266:19)
    at ChildProcess.emit (events.js:182:13)
    at emit (internal/child_process.js:811:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:5419) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

I am using the same dependencies and devDependencies as the theia-electron app (all theia dependencies on 1.4), monaco-editor-core, sprotty 0.9, sprotty-theia 0.9, and some of my own extensions.

@soerendomroes do you happen to have a reproducible repository, it’s a bit difficult to identify the problem at the moment. When upgrading, did you also update your yarn.lock (so that all @theia dependencies are 1.4.0 as well)?

You can find the repository here and the build product here.
I updated the yarn.lock,
@theia/compression-webpack-plugin is on “3.0.0”, the rest is on 1.4.0

I had some old electorn version somewhere in there, which might have caused the problem. I am currently trying to use all versions from the theia-electron yarn.lock in my build and hope that this will work.
It did.

1 Like