Skip to content

feat(remix): Add debugid injection and map deletion to sourcemaps script #8814

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

Merged
merged 8 commits into from
Aug 30, 2023

Conversation

onurtemizkan
Copy link
Collaborator

Updated sentry-upload-sourcemaps script:

  • Updated sentry-cli to: 2.20.4
  • Added a script to Inject debugids invoking sentry-cli (as this feature is not available in JS SDK of sentry-cli yet)
  • Added a script to delete sourcemaps after uploading them to Sentry. (default is to delete, created a new flag to prevent deletion)

@github-actions
Copy link
Contributor

github-actions bot commented Aug 14, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 75.26 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.21 KB (0%)
@sentry/browser - Webpack (gzipped) 21.83 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 69.76 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.16 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.15 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 220.21 KB (0%)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 85 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 59.71 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.06 KB (-0.01% 🔽)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 75.28 KB (0%)
@sentry/react - Webpack (gzipped) 21.86 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 93.13 KB (0%)
@sentry/nextjs Client - Webpack (gzipped) 50.79 KB (0%)

@AbhiPrasad
Copy link
Member

Added a script to Inject debugids invoking sentry-cli (as this feature is not available in JS SDK of sentry-cli yet)

@lforst should we expose debug id injection via the js sdk of sentry-cli?

@@ -27,7 +27,7 @@
"access": "public"
},
"dependencies": {
"@sentry/cli": "2.2.0",
"@sentry/cli": "2.20.4",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's bump this to 2.20.5 instead. It contained a pretty critical performance fix.

@lforst
Copy link
Contributor

lforst commented Aug 16, 2023

Added a script to Inject debugids invoking sentry-cli (as this feature is not available in JS SDK of sentry-cli yet)

@lforst should we expose debug id injection via the js sdk of sentry-cli?

@AbhiPrasad I am assuming you're talking about the JS API of Sentry CLI. While the Remix SDK is the only location we need something like this I'd rather not add to the CLI API just now. If something similar comes up one or two more times then we should probably add it.

@AbhiPrasad
Copy link
Member

I am assuming you're talking about the JS API of Sentry CLI

Yup I'm talking about the JS API. I think it's fair to not prio it then, there is actually quite a bit of improvements we can make to the js API overall now that I'm looking at the code.

@onurtemizkan onurtemizkan force-pushed the onur/remix-sourcemap-upload-improvements branch from 5593bd3 to d45ca37 Compare August 17, 2023 11:12
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

🚀

do you have an example event that you tested this with?

const path = require('path');

function deleteSourcemaps(buildPath) {
console.info(`Deleting sourcemaps from ${buildPath}`);
Copy link
Member

Choose a reason for hiding this comment

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

Let's append the logs with [sentry] so it's clear where this is coming from.

@onurtemizkan onurtemizkan force-pushed the onur/remix-sourcemap-upload-improvements branch from 4d03001 to 0efd98d Compare August 18, 2023 00:09
@onurtemizkan
Copy link
Collaborator Author

do you have an example event that you tested this with?

Debug Ids seem to be uploaded successfully from the local logs.

Just triggered an event from a debug id included release. Not sure if everything is in order looking at the UI, though.

Event: Link
Artifacts: Link

@lforst
Copy link
Contributor

lforst commented Aug 18, 2023

Just triggered an event from a debug id included release. Not sure if everything is in order looking at the UI, though.

In general the event looks fine to me.

Admittedly,

Screenshot 2023-08-18 at 10 25 13

looks a bit weird... But I think this comes from Symbolicator and not the SDK.


function injectDebugId(buildPath) {
try {
execSync(`node ./node_modules/@sentry/cli/bin/sentry-cli sourcemaps inject ${buildPath}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

I can imagine some environments (e.g. monorepos) where this path lookup will not succeed.

The @sentry/cli package exports a function called getPath that we can use to get the binary path. Wdyt about using it here?

Additionally, I wouldn't call the node executable but the binary directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, updated 👍

function deleteSourcemaps(buildPath) {
console.info(`[sentry] Deleting sourcemaps from ${buildPath}`);

const files = fs.readdirSync(buildPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

One more q: Is the output in the build folder always only one flat layer or could there be folders inside? Otherwise, we might need to recurse here, and/or use something like the glob library.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it was missing out the files in _shared folder. Updated 👍

@onurtemizkan onurtemizkan force-pushed the onur/remix-sourcemap-upload-improvements branch from e54acce to 22e5b7a Compare August 18, 2023 14:00
@AbhiPrasad AbhiPrasad merged commit 5fdaaa7 into develop Aug 30, 2023
@AbhiPrasad AbhiPrasad deleted the onur/remix-sourcemap-upload-improvements branch August 30, 2023 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants