-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Followed source map instructions, but line numbers are wrong, etc #2701
Comments
The only part that maybe I deviated from:
|
@ffxsam it looks like we don't even resolve your source maps, and the data itself comes from the local filesystem (its called pre/post_context data). Can you try to turn it off and upload sourcemaps with a path that matches your stacktrace?
Let me know once you change it and trigger an event. I'll then take a look at it again. |
Hey @kamilogorek, thanks for the help! So, I made the two changes you suggested. It's definitely better, but the referenced line number is just slightly off for some reason: |
Because if we already have context lines, we don't resolve source maps. Can you link the issue above? When you see error like this, it means that release artifacts doesnt contain the file it points to. |
Sure: https://sentry.io/organizations/reelcrafter/issues/1770164594/?project=5298557 This is my release script: #!/bin/sh
export RELEASE=$(sentry-cli releases propose-version)
# Create a release
sentry-cli releases new -p big-test --finalize $RELEASE
# Associate commits with the release
sentry-cli releases set-commits --auto $RELEASE
# Deploy
sls deploy And the output from running that script:
|
@ffxsam I spent some time reproducing everything on AWS with Serverless Framework and was able to get it working just fine There is one necessary change in order for stacktrace to resolve only your real frames, as well as skip internal and mark them as "non-app frames". import { basename } from "path";
Sentry.init({
dsn: "...",
release: process.env.RELEASE,
integrations: [
new RewriteFrames({
iteratee(frame) {
if (frame.function.startsWith("Runtime")) {
frame.in_app = false;
} else {
frame.filename = `app:///${basename(frame.filename)}`;
}
return frame;
}
})
],
frameContextLines: 0
}); However, it still doesn't answer the question why your sourcemaps are malformed. There's definitely a problem with webpack pipeline though. I used your exact config and it works just fine for me. |
Thanks for the additional info. I've created a fresh repository and just invited you to it: This was created via This time, it doesn't work well at all, as you can see here: https://sentry.io/organizations/reelcrafter/issues/1772989686/?project=5319096 Any help would be greatly appreciated! We rely heavily on serverless architecture, so we really need Sentry to log everything accurately. Thanks! |
Oh, and run |
@ffxsam you forgot to import |
Oops! I don't remember if that was in there last time. The webpack config is pretty much what Serverless creates out of the box. Thanks for your help! And feel free to modify my repo directly. |
@ffxsam works like a charm, just import |
@kamilogorek Still no luck for me. Could you please clone this repo (https://github.com/ffxsam/source-map-test/), change the DSN, run |
@ffxsam there are 2 things I found.
Once I changed these 2 things, I got it working without any code changes. |
@kamilogorek I've been purposely making commits in order to have a unique release hash each time, so that shouldn't be an issue. I'll try removing |
No luck for me. 😢 Same result as above, it's off by a few lines. I did try using After I run BTW, I appreciate all your time and help! Don't worry, I'm a paid Sentry customer. 😆 |
😶 I found the main issue. It's TerserPlugin messing around with the source code.
Add this to your webpack config and you should be good no matter what You can play around with
Anytime, I'm curious myself what's going in here :D |
@kamilogorek You rock!! This totally solved it, thank you! So is this an issue with Webpack in general? Or just the way this Serverless template is set up? |
BTW, it seems removing |
@ffxsam I was struggling with this issue as well for a while. A few weeks ago I wrote an article on how to make it work. Maybe it helps you: Fix sentry sourcemaps in AWS lambda functions TLDR:
|
@botond-veress thanks for the write-up! :)
@ffxsam apparently there's a way to keep the optimizations if you preserve original sources (vide blogpost above). TIL! |
@botond-veress There's something wrong with your blog post. The code blocks are all one line. Also, the code in your repo doesn't seem to match the blog post. |
Ahh, I just figured out why this solution was working fine on my test project, but not an actual real project! In my real project, all my code is under new SentryPlugin({
release: process.env.SENTRY_RELEASE,
include: "./.webpack/service/src",
}), When it was just |
For anyone who might still have problems with the source map line numbers while using Terser plugin, I could get it working properly by disabling the following compress options in
|
Closing the issue, as it seems like the original issue has been resolved. |
Package + Version
@sentry/node
- 5.18.1@sentry/integrations
- 5.18.1@sentry/webpack-plugin
- 1.11.1Description
I've followed the instructions on source maps to the best of my knowledge. I'm trying this out with a Serverless Framework setup.
It's quite an improvement over how reporting looked before I followed the steps, but the line number is totally wrong and the module name is missing. There's also still remnants of webpack variable names.
https://sentry.io/organizations/reelcrafter/issues/1749922899/?project=5298557
webpack.config.js
test.js
The text was updated successfully, but these errors were encountered: