mattermost-desktop runs ins development mode
Description:
It seems that the desktop client runs in development mode rather than in production / packaged mode. This leads to unexpected behavior. First, the command output contains messages like
[AutoLauncher] In development mode, autostart config never effects
Second, this prevents me from logging in using a GitLab SSO, because the callback URI starts with mattermost-dev://
instead of mattermost://
and the former is not registered in my browser.
I traced the aforementioned log message:
https://github.com/mattermost/desktop/blob/ab014c26a285dc28f27971365d1bf0ddac277117/src/main/AutoLauncher.ts#L41
So it uses the electron-is-dev
package. Its main logic is found here:
https://github.com/sindresorhus/electron-is-dev/blob/v2.0.0/index.js.
ELECTRON_IS_DEV
is not set, so it checks electron.app.isPackaged
which is false
on my system. This is weird.
Then I found https://github.com/electron/electron/issues/35153 and checked the implementation of isPackaged
: https://github.com/electron/electron/blob/v27.3.5/shell/browser/api/electron_api_app.cc#L951
My understanding of the code agrees with the linked issue, meaning that electron considers itself only packaged if its main called binary is called electron
, without any suffix. And here's the problem, because this package uses electron 27 and therefore the main binary is called electron27
and not just electron
.
Now I am not too involved in the whole electron ecosystem, but this sounds to me like you can't have multiple electron versions in e.g. /usr/bin/
that all consider themselves "packaged". One workaround seems to be to set the ELECTRON_FORCE_IS_PACKAGED
env variable before calling electron. I verified that my local mattermost installation considered itself to run in production mode after I set this. Maybe this could be a workaround for the mattermost-desktop.sh
wrapper script?
Additional info:
- package version(s): 5.6.0-1
- config and/or log files:
- link to upstream bug report, if any:
Steps to reproduce:
- Install
mattermost-desktop
package - Run
mattermost-desktop
- Inspect command output or try to log in with e.g. a GitLab instance