-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Source code was not found for index.js #1785
Comments
Can you post a direct link to the event? (you also missed some paths in the stacktrace screenshot you masked earlier 😅) Any particular reason why you don't use |
Yepp, this is the event: https://sentry.io/share/issue/e2c8d20b66d2406cb32c540d87654b4a/ (slightly modified to not publish our dsn) The reason, why I use |
@guischdi the reason why you get this error is that local file paths are not reachable to remote servers. To upload your files, you can use our CLI https://docs.sentry.io/cli/ or Webpack plugin https://github.com/getsentry/sentry-webpack-plugin Here are some old docs on source maps, but the concept is the same for new SDK https://docs.sentry.io/clients/node/sourcemaps/ (it all applies in the same way to your current issue). There's also an existing integration you can use to rewrite paths in every frame https://github.com/getsentry/sentry-javascript/blob/master/packages/core/src/integrations/pluggable/rewriteframes.ts So for example: Sentry.init({
dsn: "https://363a337c11a64611be4845ad6e24f3ac@sentry.io/297378",
integrations: [new Sentry.Integrations.RewriteFrames()]
}); Will change Basically what you need to do is:
Hope it clears some things for you. Feel free to ask anything if you need more help. |
Hi @kamilogorek Did I get it right: The common way to have a stack trace of a Node.js application show up in Sentry is to upload the files of each release via RewriteFrames integration or manually? If so, how comes that the stack trace on I tested how throwing an Error in a So why does this work with |
@guischdi can you past full link to both events? Not shareable ones? I can access them through admin permissions. Also, I'll be out of office for the next 3 weeks, so I'll try to get back to this one when I'll come back. |
Thanks for having a look at this! |
@kamilogorek Do you mean I need to upload whole |
I confirm that after setting frames integration and basically uploading whole I believe the solution to this is either:
Also, I was having problem with source maps that referenced original |
@kamilogorek Any news on this issue? |
I can also confirm that rewriting frames was the solution for us. Our case is a bit different, we were trying to make sourcemaps work, but the minified file was always the one used by Sentry. For the corresponding release, we are uploading minified files as well as associated sourcemaps. It appears Sentry was not finding the sourcemap, and was defaulting to the minified file (which is still hosted at the same path than the sourcemaps though). We just added |
It's good to know, that the
So the following question remains open:
Or more precisely: One can simply capture an error via |
@guischdi sorry for such a late response. I lost a track a bit. Can you refresh my memory what's going on here and provide some sample events? |
@kamilogorek
|
@guischdi just to confirm, this is raw node js file right? no webpack, no compilation, no source maps. Just one |
@kamilogorek |
@guischdi we are investigating why it's behaving like this (2 consecutive frames with the same url triggers this). In the meantime, you can turn off "Enable JavaScript Source Fetching" in your project's settings, eg. https://sentry.io/settings/kamil-ogorek/projects/testing-project/ |
@kamilogorek Ok, I turned off the "Enable JavaScript Source Fetching" setting and triggered another error. But still |
Odd, that works for me just fine. Anyways, we'll try to investigate why that happens, although I cannot promise when it happens, as it's not major issue preventing anything from working. Will keep you posted! |
@kamilogorek any news on this? For me the issue view reports the source code as missing a few files, but they are all present and viewable under the stack trace. |
I'm running Sentry self-hosted and using Heres my code: // file: <path>/code/cli
const Sentry = require('@sentry/node');
Sentry.init({ dsn: process.env.SENTRY_DSN });
function test () {
throw new Error('test');
}
test(); I'm also getting this error: And here is the stack:
|
I'm also running into this issue |
@LukeXF can you provide a link to an affected event? |
The reason you can see source context (which is to say, code above and below the line in question) even though you're getting "can't find source code" errors is that in the SDK, before we send the event, we record this information as part of processing the stacktrace. The error is coming from the server also trying to fill in that information. That's a bug on our end, though, because we're not actually expecting you to upload Once that fix lands, can anyone who's commented here please let us know if you still have problems/questions, and what they are? Happy to re-open this if needed. |
Hi @lobsterkatie const Sentry = require('@sentry/node');
Sentry.init({ dsn: process.env.DSN });
(async () => {
Sentry.captureException(new Error('Good bye'));
})(); Unfortunately we still get the Also tested with the current v4.x.x version (v4.6.6) and the latest release (v5.14.0) of @sentry/node. |
@guischdi you didn't upload any artifacts, nor included a release in your configuration. Please follow the docs first: https://docs.sentry.io/platforms/node/sourcemaps/ |
If I understood @lobsterkatie right in that point (quoted above), I should not need to upload the code. In the issue link you can see all the source code context needed to understand the issue (in this case all the source code of the script). So this seems to be recorded properly. I don't think I need to upload/serve sourcemaps (as your link proposes), because it's an un-minified plain Node.js program. |
@guischdi The file it's looking for is from your app, not from node_modules, so the change I made (to more successfully exclude 3rd party code) wouldn't apply here. The reason we try to process source maps for node apps is that while it's true that the code is very likely not minified, it could quite easily be transpiled (if it were written in typescript, for instance), and so we'd need source maps to display the code as written rather than the output from babel. |
Ok, so this looks like a UX bug to me. In my opinion it should (at least for Node.js projects) be only a warning and it must not say |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
The following event capturing code will produce an error in Sentry while parsing the event:
Source code was not found for /.../index.js
Here is how the event looks like in Sentry:
The text was updated successfully, but these errors were encountered: