Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tech] Source map support for the Backend #3823

Merged
merged 1 commit into from
Jul 11, 2024
Merged

Conversation

CommandMC
Copy link
Collaborator

@CommandMC CommandMC commented Jun 14, 2024

The Backend is now aware of the source map included with development builds of Heroic, meaning error stacktraces turn from something completely unhelpful:

(node:21029) UnhandledPromiseRejectionWarning: Error: A scary error
    at Yu (/home/mathis/src/HeroicGamesLauncher/build/main/main.js:114:807)
    at fm (/home/mathis/src/HeroicGamesLauncher/build/main/main.js:98:4744)
    at /home/mathis/src/HeroicGamesLauncher/build/main/main.js:184:24278

into very clear:

(node:22829) UnhandledPromiseRejectionWarning: Error: A scary error
    at LegendaryLibraryManager.initLegendaryLibraryManager (/home/mathis/src/HeroicGamesLauncher/src/backend/storeManagers/legendary/library.ts:79:9)
    at initStoreManagers (/home/mathis/src/HeroicGamesLauncher/src/backend/storeManagers/index.ts:81:9)
    at /home/mathis/src/HeroicGamesLauncher/src/backend/main.ts:306:23

Note that this is only a feature in development builds of Heroic. Including it in release builds would be possible, but would add about 20MB onto any build

The Frontend is already able to parse these by default, so I've not added the source-map-support module there. Similarly, the preload is so small that it'd probably not help much there.

Additionally, I've enabled minification for development builds now as well, as it just leads to less work for Node when parsing the JS file


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@CommandMC CommandMC requested review from a team, arielj, flavioislima, Etaash-mathamsetty, Nocccer and imLinguin and removed request for a team June 14, 2024 22:11
@CommandMC CommandMC self-assigned this Jun 14, 2024
@CommandMC CommandMC added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jun 14, 2024
Copy link
Collaborator

@arielj arielj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great

I see some minified code but maybe it's not possible to have all the methods/function names? not sure but for example I got this error:

(22:02:46) ERROR:   [Legendary]:        TypeError: Cannot read properties of null (reading 'find')
    at hp (/home/ariel/dev/oss/HeroicGamesLauncher/src/backend/storeManagers/legendary/games.ts:163:48)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Module.mp [as getExtraInfo] (/home/ariel/dev/oss/HeroicGamesLauncher/src/backend/storeManagers/legendary/games.ts:314:16)
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:79404)

and the paths are correct, but it shows at hp and at Module.mp for function in those 2 source files

I got that issue opening a game page (>Observer_) and it failed to get the productSlug if it helps with debugging

I'm fine without the function name though if this is not easy to solve, the file name and line is already great and the function names can be found easily once you get there

@CommandMC
Copy link
Collaborator Author

Not sure why that's happening, it might have trouble with us having multiple getExtraInfo functions (one for each store)? I see the same happening for launch for example, but it doesn't happen for unique ones (initLegendaryLibraryManager in my example above)

The important thing (for me at least) are the line numbers though, being able to click those in the terminal to pull up the relevant code is still very helpful

@arielj
Copy link
Collaborator

arielj commented Jul 11, 2024

I think it's fine to ignore that then, the ts file with the line number is already enough

@CommandMC CommandMC merged commit 9c276a8 into main Jul 11, 2024
9 checks passed
@CommandMC CommandMC deleted the tech/exceptions-sourcemap branch July 11, 2024 23:11
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants