SpacingBat3 / WebCord

A Discord and SpaceBar :electron:-based client implemented without Discord API.
MIT License
1.83k stars 94 forks source link

Crash on Help -> About - v4.6.0 #497

Closed dreamsyntax closed 6 months ago

dreamsyntax commented 7 months ago

Acknowledgements

Operating System / Platform

🪟️ Windows & :penguin: Linux

Operating system architecture

x64 (64-bit Intel/AMD)

Electron version

18 - per release notes (unable to see in about)

Application version

v4.6.0

Bug description

Reproduce steps (Windows):

The program will either crash, or a blank about dialog will appear and constantly spam reloading state.

Confirmed this is not unique to Windows, also happens in arch linux (used AUR webcord-bin)

Additional context

Video of the case when the program does not crash https://github.com/SpacingBat3/WebCord/assets/14857235/fbbfa84c-11f2-4d9d-b166-b49b9018c70a

SpiritOTHawk commented 7 months ago

Confirm

SpacingBat3 commented 7 months ago

Info from the DevTools console of the blank window (not from window that displays Discord interface, you should be able to go to DevTools with Ctrl+i once the correct window is in foreground/selected) or logs in the regular console if it crashes at main process?

dreamsyntax commented 7 months ago

Info from the DevTools console of the blank window (not from window that displays Discord interface, you should be able to go to DevTools with Ctrl+i once the correct window is in foreground/selected) or logs in the regular console if it crashes at main process?

All I see is AppCrashedFatalReport: getLastCrash not supported. in dev tools (ctrl+shift+i after enabling developer mode in File->settings) in case when it full crashes

If I launch in cli and click about

$ webcord
[WebSocket] Listening at port 6463.
[UPDATE] Application is up-to-date!
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
[WC_9:139] crashed
Crash count exceeded (>10), relaunching in safe mode...

If you are asking me to open the dev tools on the About window itself, I have not had luck getting it to appear like in the video, most of the time the crash loop happens without it ever opening.

SpacingBat3 commented 7 months ago

So the renderer crashes... And I think why.

The problem is, I think I might be using the import() in the About window's preload script – and that import() is for Chromium context than Node's. I mean, Node16 kinda adds the import() to use ESM right now, and ESM was, well... kinda problematic for a long time in Electron and even right now it has its own quirks that developers shall be aware of.

I'll have to check the code and rewrite it so no import() statements are there. For now, I'm not confirming the issue until I'll test it or approach fixing.

SpacingBat3 commented 7 months ago

Just tested this and can confirm. 99.99% the issue caused by me forgetting to prepare preloads and remove import().