-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Issue: Source Maps Not Correctly Mapping Stack Trace in Sentry #2127
Comments
Yes, missing Debug ID in the event can certainly explain the behavior you are observing here. Usually this occurs when the code you are running when testing your app does not have the Debug IDs injected. From the snippet you provided, though, it does indeed look like the Debug IDs are there. Are you absolutely certain that the code you are running when testing the app out is the code that has the Debug IDs injected? And, did you inject Debug IDs into all of your JavaScript code, not just this one file? You could also try uploading sourcemaps using one of our bundler plugins. These might be easier to setup than the Sentry CLI |
Thank you for your prompt reply. I want to confirm that I am 100% sure that the debug ID has been injected by the CLI, and the same files were uploaded to both Sentry and our servers. I suspect that the issue might be related to pm2-runtime, which we are using to run our server. pm2-runtime utilizes source-map-support for logging purposes, and unfortunately, it does not have a flag to disable source-map-support. According to the documentation, the --disable-source-map-support flag is available for pm2, but not for pm2-runtime. Here is how I start my server: {
"start": "./node_modules/pm2/bin/pm2-runtime ./dist/index.js -i max && npm run pm2:logs",
"pm2:logs": "node ./node_modules/pm2/bin/pm2 logs"
} I attempted to run the server with a simple node command and it worked !!!!!!!! , but I want to use pm2 for process management. Additionally, I found a related issue in the PM2 GitHub repo that describes a similar problem: Unitech/pm2#5003 It seems that the stack trace is being altered by pm2-runtime, and Sentry is unable to process it correctly, causing issues with attaching debug_meta in the event. One more thing: I’ve read every Sentry blog and checked replies from the Sentry team on GitHub issues related to this problem. In most cases, the response from you guys is always same that the source maps uploaded to Sentry are not the same as those on the server. Why is there such certainty about this being the issue? The problem could be something else, just like in my case. |
@haseeb-numu In case pm2 messes with |
Have you guys considered rethinking the logic of attaching debug_id to events? It seems there are ongoing issues with integrations, such as with Cordova and now PM2 runtime. |
@haseeb-numu Not really no. Messing with |
CLI Version
2.33.1
Operating System and Architecture
Operating System Version
Amazon Linux 2/5.9.4
Link to reproduction repository
No response
CLI Command
sentry-cli sourcemaps upload
Exact Reproduction Steps
Steps to Reproduce
Initialize Sentry:
I initialized Sentry in my Node.js project on top of index file by import sentry-instrument.js.
Configure CodeBuild:
Push the Code:
I pushed the code to the repository, triggering the pipeline in AWS CodePipeline.
The pipeline runs, and the build specifications are executed in CodeBuild.
Deploy to Sentry and Elastic Beanstalk:
build code was injected with debug-id and uploaded to sentry.
I created an endpoint in my application that intentionally throws an exception to test Sentry's error reporting functionality. This is how I verified that the errors are being sent to Sentry.
Expected Results
I expect the Sentry stack trace to accurately map to the original source code, displaying the exact line of code where the error occurred, based on the uploaded source maps. This would help in pinpointing the issue directly in the original code rather than in the build artifacts.
Actual Results
When I throw an error to Sentry via API, Stack trace only shows line number of the error correctly. However, it does not display corresponding code from original source file. Source maps are not being utilized as expected to reveal specific line of code where error occurred.
and this event's json has no debug-id (i am assuming here is the problem)
Uploaded source maps on Sentry do include this file.
I also checked uploaded code on the server, and it does have Sentry debug ID injected:
Sentry source map code
I initially tried using Sentry SDK version 7, but it did not work as expected. I then migrated to SDK version 8, yet I am encountering the same issue with stack trace mapping.
Logs
I'll share the full log output.
The text was updated successfully, but these errors were encountered: