Closed andykais closed 5 years ago
Our SDK is not able to resolve source maps locally sorry :/ It's very unlikely that we will ever support this since we only want this logic to be on the server.
We always need you to upload the sources maps to sentry in order to symbolicate the stack trace.
The documentation is confusing about whether inline sources are supported. It should make it clearer than it is not supported and also remove references like "inlineSources": true,
from the examples. https://docs.sentry.io/platforms/javascript/sourcemaps/
@alvinypyim inlineSources
is not inlineSourceMap
(which is the question of the original issue). inlineSources
is supported just fine and you can upload a bundle which has both, source and map in the same file.
@kamilogorek Hey, I thought I'd ask this question here since it's relevant, and it's the top Google search result for "sentry inline source map":
Can Sentry's source map implementation now support a single JS file with the map embedded in it, as well as the full sources? (e.g. esbuild options { "sourcemap": "inline", "sourcesContent": true }
) Or does the .map
file still need to be separate from the JS file?
BTW, I agree with @alvinypyim above - the docs could be more explicit as far as telling us if inline maps and/or inline sources are supported.
Can Sentry's source map implementation now support a single JS file with the map embedded in it, as well as the full sources? (e.g. esbuild options { "sourcemap": "inline", "sourcesContent": true }) Or does the .map file still need to be separate from the JS file?
Yes it does, and you don't need .map
file for that. Although note that when using sentry-cli
, it'll warn you that it cannot resolve map url. It's fine, as maps are encoded as base64, which we do then parse and use as the source maps body - https://github.com/getsentry/sentry/blob/50e4c8102fb40cc0455759ad577e591083d59b60/src/sentry/lang/javascript/processor.py#L691-L715
There is however one issue that I discovered, reported here https://github.com/getsentry/sentry/issues/27797 I'll update docs once we get it resolved.
Yes it does, and you don't need
.map
file for that
Hi @kamilogorek , if it can support a js file with the base64 source map embedded on the file. Is there a reason why it is not supported for typescript?
I also tried to configure my typescript project to use "inlineSourceMap": true, "inlineSources": true
but it doesn't seem to work.
I can see that the compiled js files already have //# sourceMappingURL=data:application/json;base64,...
at the end or I'm probably missing something? here's my tsconfig:
{
"compilerOptions": {
"lib": ["es6"],
"types": ["reflect-metadata", "node", "express"],
"allowJs": true,
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"noImplicitAny": true,
"strictNullChecks": true,
"outDir": "./dist/",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*", "vendor/*"],
"src/*": ["./src/*"]
},
"skipLibCheck": true,
"inlineSourceMap": true,
"inlineSources": true,
"sourceRoot": "/",
"target": "es6",
"typeRoots": ["node_modules/@types"]
},
"exclude": ["clients", "dist"]
}
@danieljohngomez do you have any example issue in Sentry that is not processed correctly?
@kamilogorek Here https://sentry.io/organizations/daniel-t9/issues/2989154106/events/a45bdf1ba5c94008861e7a22238f5a5f/?project=6185976
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhhbXBsZS13b3JrZXIuanMiLCJzb3VyY2VSb290IjoiLyIsInNvdXJjZXMiOlsic3JjL3dvcmtlcnMvZXhhbXBsZS13b3JrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFBQSwyQkFBeUI7QUFFekIsb0RBQW9EO0FBQ3BELHdDQUF3QztBQUN4QywyQkFBeUI7QUFDekIsNkVBQXFGO0FBQ3JGLHVDQUFzRDtBQUV0RCxDQUFDLEdBQVMsRUFBRTtJQUNSLElBQUEsMkNBQWlCLEVBQUM7UUFDZCxHQUFHLEVBQUUsbUJBQVU7UUFDZixXQUFXLEVBQUUscUJBQVk7UUFDekIsV0FBVyxFQUFFLE9BQU87S0FDdkIsQ0FBQyxDQUFDO0lBQ0gsSUFBQSx5Q0FBZSxFQUFDLElBQUksS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7QUFDdkMsQ0FBQyxDQUFBLENBQUMsRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICcuLi9tb2R1bGUtYWxpYXMnO1xuXG4vLyBUaGlzIG5lZWRzIHRvIGJlIGltcG9ydGVkIGJlZm9yZSBldmVyeXRoaW5nIGVsc2UuXG4vLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgaW1wb3J0L29yZGVyXG5pbXBvcnQgJ3NyYy9saWJzL3RyYWNlcic7XG5pbXBvcnQgeyBpbml0RXJyb3JUcmFja2luZywgcHVibGlzaFRvU2VudHJ5IH0gZnJvbSAnQGJveGJhZy94c2gtbm9kZS1lcnJvci10cmFja2luZyc7XG5pbXBvcnQgeyBTRU5UUllfRFNOLCBTRVJWSUNFX05BTUUgfSBmcm9tICdzcmMvY29uZmlnJztcblxuKGFzeW5jICgpID0+IHtcbiAgICBpbml0RXJyb3JUcmFja2luZyh7XG4gICAgICAgIGRzbjogU0VOVFJZX0RTTixcbiAgICAgICAgc2VydmljZU5hbWU6IFNFUlZJQ0VfTkFNRSxcbiAgICAgICAgZW52aXJvbm1lbnQ6ICdsb2NhbCdcbiAgICB9KTtcbiAgICBwdWJsaXNoVG9TZW50cnkobmV3IEVycm9yKCd0ZXN0JykpO1xufSkoKTtcbiJdfQ==
You are not uploading any artifacts to your release. We cannot reach your localhost to scrape the files 😅
I see I thought the base64 string is possible to be extracted somehow. Thanks for checking
Source map resolution is performed on the server-side, not through the SDK, so unfortunately not. Although I see you are using Node SDK, which means that it can be done using https://github.com/evanw/node-source-map-support (note that this breaks our server-side resolution, but because you are not using it anyway, it should be fine)
nice thanks for the suggestion @kamilogorek , I will try this
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
Continuation of a question in #620, can sentry report proper error lines from source maps if they are inlined? If my tsconfig has the following, will sentry automatically report error lines correctly? What if we use node-source-map-support?