sentry-javascript
sentry-javascript copied to clipboard
[SENTRY-NODE] Sourcemap not working Nestjs + Typescript + @ntegral/nestjs-sentry
Is there an existing issue for this?
- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [X] I have reviewed the documentation https://docs.sentry.io/
- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
7.94.1
Framework Version
Nestjs 10.2.8
Link to Sentry event
https://insolite.sentry.io/issues/4920241225/events/e6a57bcbe30644a482c074347ac3b5bf/
SDK Setup
SentryModule.forRoot({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
integrations: [
rewriteFramesIntegration({
iteratee: (frame) => {
//if (!frame.filename) return frame;
console.log('before frame', frame);
console.log('__dirname', __dirname);
console.log('frame.filename', frame.filename);
console.log('process.cwd()', process.cwd());
return frame;
},
}),
new ProfilingIntegration(),
new Sentry.Integrations.GraphQL(),
new Sentry.Integrations.Apollo({ useNestjs: true }),
//new Sentry.Integrations.Prisma({ client })
],
release: `${name}@${version}`,
tracesSampleRate: 1.0,
logLevels: ['debug'], //based on sentry.io loglevel //
}),
Steps to Reproduce
if I generate a build and the sourcemap in local and your script that I generate wizard uploads it and I raise production in local, I generate an error and everything works fine. But if I do the same in the continuous integration system it doesn't show the frame as if the sourcemap was not uploaded, it is and it has been generated the same as in local, I have checked that it generates the same debugIDs, it hooks to the same release, I have tried to check the files in the servirdor, I have tried to rewrite the frames, I have tried to do a thousand things. Locally I work on Mac, on the ci it is built on Ubuntu and the Docker on the server is debian. I think there must be something between the debian server where the application is uploaded and the sourcemaps paths that something doesn't fit, or there's a bug
Expected Result
Expected result, that when an error occurs, the code fragment where it failed will be displayed.
Actual Result
This is the display on action CI that fails https://insolite.sentry.io/issues/4920241225/events/e6a57bcbe30644a482c074347ac3b5bf/
Log sourcemap
> sentry-cli sourcemaps inject --release $(npm version | grep ora-back | tr -d ',' | tr -d "'" | sed 's/: /@/g') --org insolite --project ora-back ./dist && sentry-cli sourcemaps upload --release $(npm version | grep ora-back | tr -d ',' | tr -d "'" | sed 's/: /@/g') --org insolite --project ora-back ./dist
> Searching ./dist
> Found 294 files
> Analyzing 294 sources
> Injecting debug ids
Source Map Debug ID Injection Report
Modified: The following source files have been modified to have debug ids
e7797a81-94e0-5d66-aa9d-6a5d881b9706 - ./dist/src/app.module.js
6442652f-62a4-5f57-bbde-fea7ddf87bbb - ./dist/src/graphql.schema.js
3f54c21e-64b3-5398-9c91-fdd5b80e359a - ./dist/src/main.js
b6bbd747-2f1b-[55](https://github.com/Insolite-Solutions-SL/ora-back/actions/runs/7673218975/job/20915370775#step:4:56)2d-9a05-cba8e8480be8 - ./dist/src/modules/accident/accidents.module.js
83915e79-ed59-58c3-bf89-b925b77476b7 - ./dist/src/modules/accident/accidents.resolver.js
70ca6206-a[56](https://github.com/Insolite-Solutions-SL/ora-back/actions/runs/7673218975/job/20915370775#step:4:57)c-5640-b2ac-77c14eeea0eb - ./dist/src/modules/accident/accidents.service.js
b1f18650-1e8d-56fe-a861-9[57](https://github.com/Insolite-Solutions-SL/ora-back/actions/runs/7673218975/job/20915370775#step:4:58)6c8b1c557 - ./dist/src/modules/accident/attentionAccident/attentionAccident.module.js
e3177786-ada8-5554-bf9b-f4e6e97ff2a4 - ./dist/src/modules/accident/attentionAccident/attentionAccident.resolver.js
f61887fc-0e59-5807-9c85-157800d8af10 - ./dist/src/modules/accident/attentionAccident/attentionAccident.service.js
c1ae5a06-0e49-546e-8196-2e2adfffacff - ./dist/src/modules/accident/conditionsDriving/conditionsDriving.module.js
0af64b7d-3a4e-585f-bda5-4b3e2438308f - ./dist/src/modules/accident/conditionsDriving/conditionsDriving.resolver.js
db648395-d367-54d3-ae2c-64db182580e4 - ./dist/src/modules/accident/conditionsDriving/conditionsDriving.service.js
d274e132-65ed-5121-ab87-e22e60d6e4d6 - ./dist/src/modules/accident/image/image.module.js
eb2feeb0-67f2-5b47-9908-31894109b9be - ./dist/src/modules/accident/image/image.resolver.js
cdfb6ab6-09b4-5596-bddd-2f9fc167d34b - ./dist/src/modules/accident/image/image.service.js
a11344c8-9e74-50b8-8b6e-d236a86845f2 - ./dist/src/modules/accident/luminosity/luminosity.module.js
bb5633d5-9deb-51a8-ad70-8950247a59ee - ./dist/src/modules/accident/luminosity/luminosity.resolver.js
80041dea-6ce6-5f58-9ac2-e4325e02589b - ./dist/src/modules/accident/luminosity/luminosity.service.js
5309f638-d21a-54eb-9798-8a25249f754b - ./dist/src/modules/accident/mediumKnowledge/mediumKnowledge.module.js
6ef832fd-aee3-5eba-b212-a4d500a07acb - ./dist/src/modules/accident/mediumKnowledge/mediumKnowledge.resolver.js
f8a85924-8015-5207-9a0a-083a13b356da - ./dist/src/modules/accident/mediumKnowledge/mediumKnowledge.service.js
2889a494-4906-550e-aa37-2bf24f779d5b - ./dist/src/modules/accident/surfaceCondition/surfaceCondition.module.js
9d9bdcbc-d9e8-5360-a2da-b79e40237fc9 - ./dist/src/modules/accident/surfaceCondition/surfaceCondition.resolver.js
3c1ee6e0-0458-541a-b7ab-aabdc5d6969f - ./dist/src/modules/accident/surfaceCondition/surfaceCondition.service.js
0281ad30-c11b-5533-9a8f-dd5bcf6d4d88 - ./dist/src/modules/accident/surveillanceBody/surveillanceBody.module.js
40ce542b-e0ed-5859-b783-ce38ea6a886f - ./dist/src/modules/accident/surveillanceBody/surveillanceBody.resolver.js
f34c0b0f-6a84-55f6-9e5f-ca9b53308e6c - ./dist/src/modules/accident/surveillanceBody/surveillanceBody.service.js
f36d228c-ceba-5a59-af5a-772b8c7e3c0a - ./dist/src/modules/accident/weather/weather.module.js
8f557721-9c0d-5412-887f-5a67ebcbb8d5 - ./dist/src/modules/accident/weather/weather.resolver.js
0c09b155-c43a-57bf-9672-76fdbf3d8004 - ./dist/src/modules/accident/weather/weather.service.js
> Found 294 files
> Analyzing 294 sources
> Rewriting sources
> Adding source map references
> Bundled 294 files for upload
> Bundle ID: e4cfc5b4-9a7d-56ee-9aed-b1be59fdf1d3
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: insolite
> Project: ora-back
> Release: [email protected]
> Dist: None
> Upload type: artifact bundle
Source Map Upload Report
Minified Scripts
~/src/app.module.js (sourcemap at app.module.js.map, debug id e7797a81-94e0-5d66-aa9d-6a5d881b9706)
~/src/graphql.schema.js (sourcemap at graphql.schema.js.map, debug id 6442652f-62a4-5f57-bbde-fea7ddf87bbb)
~/src/main.js (sourcemap at main.js.map, debug id 3f54c21e-64b3-5398-9c91-fdd5b80e359a)
~/src/modules/accident/accidents.module.js (sourcemap at accidents.module.js.map, debug id b6bbd747-2f1b-552d-9a05-cba8e8480be8)
~/src/modules/accident/accidents.resolver.js (sourcemap at accidents.resolver.js.map, debug id 83915e79-ed59-[58](https://github.com/Insolite-Solutions-SL/ora-back/actions/runs/7673218975/job/20915370775#step:4:59)c3-bf89-b925b77476b7)
~/src/modules/accident/accidents.service.js (sourcemap at accidents.service.js.map, debug id 70ca6206-a56c-5640-b2ac-77c14eeea0eb)
~/src/modules/accident/attentionAccident/attentionAccident.module.js (sourcemap at attentionAccident.module.js.map, debug id b1f18650-1e8d-56fe-a861-9576c8b1c557)
~/src/modules/accident/attentionAccident/attentionAccident.resolver.js (sourcemap at attentionAccident.resolver.js.map, debug id e3177786-ada8-5554-bf9b-f4e6e97ff2a4)
~/src/modules/accident/attentionAccident/attentionAccident.service.js (sourcemap at attentionAccident.service.js.map, debug id f61887fc-0e[59](https://github.com/Insolite-Solutions-SL/ora-back/actions/runs/7673218975/job/20915370775#step:4:60)-5807-9c85-157800d8af10)
~/src/modules/accident/conditionsDriving/conditionsDriving.module.js (sourcemap at conditionsDriving.module.js.map, debug id c1ae5a06-0e49-546e-8196-2e2adfffacff)
~/src/modules/accident/conditionsDriving/conditionsDriving.resolver.js (sourcemap at conditionsDriving.resolver.js.map, debug id 0af64b7d-3a4e-585f-bda5-4b3e2438308f)
~/src/modules/accident/conditionsDriving/conditionsDriving.service.js (sourcemap at conditionsDriving.service.js.map, debug id db648395-d367-54d3-ae2c-64db182580e4)
~/src/modules/accident/image/image.module.js (sourcemap at image.module.js.map, debug id d274e132-65ed-5121-ab87-e22e[60](https://github.com/Insolite-Solutions-SL/ora-back/actions/runs/7673218975/job/20915370775#step:4:61)d6e4d6)
~/src/modules/accident/image/image.resolver.js (sourcemap at image.resolver.js.map, debug id eb2feeb0-67f2-5b47-9908-31894109b9be)
~/src/modules/accident/image/image.service.js (sourcemap at image.service.js.map, debug id cdfb6ab6-09b4-5596-bddd-2f9fc167d34b)
~/src/modules/accident/luminosity/luminosity.module.js (sourcemap at luminosity.module.js.map, debug id a11344c8-9e74-50b8-8b6e-d236a86845f2)
~/src/modules/accident/luminosity/luminosity.resolver.js (sourcemap at luminosity.resolver.js.map, debug id bb5633d5-9deb-51a8-ad70-8950247a59ee)
~/src/modules/accident/luminosity/luminosity.service.js (sourcemap at luminosity.service.js.map, debug id 80041dea-6ce6-5f58-9ac2-e4325e02589b)
~/src/modules/accident/mediumKnowledge/mediumKnowledge.module.js (sourcemap at mediumKnowledge.module.js.map, debug id 5309f638-d21a-54eb-9798-8a25249f754b)
~/src/modules/accident/mediumKnowledge/mediumKnowledge.resolver.js (sourcemap at mediumKnowledge.resolver.js.map, debug id 6ef832fd-aee3-5eba-b212-a4d500a07acb)
~/src/modules/accident/mediumKnowledge/mediumKnowledge.service.js (sourcemap at mediumKnowledge.service.js.map, debug id f8a85924-8015-5207-9a0a-083a13b356da)
~/src/modules/accident/surfaceCondition/surfaceCondition.module.js (sourcemap at surfaceCondition.module.js.map, debug id 2889a494-4906-550e-aa37-2bf24f779d5b)
~/src/modules/accident/surfaceCondition/surfaceCondition.resolver.js (sourcemap at surfaceCondition.resolver.js.map, debug id 9d9bdcbc-d9e8-5360-a2da-b79e40237fc9)
~/src/modules/accident/surfaceCondition/surfaceCondition.service.js (sourcemap at surfaceCondition.service.js.map, debug id 3c1ee6e0-0458-541a-b7ab-aabdc5d6969f)
~/src/modules/accident/surveillanceBody/surveillanceBody.module.js (sourcemap at surveillanceBody.module.js.map, debug id 0281ad30-c11b-5533-9a8f-dd5bcf6d4d88)
~/src/modules/accident/surveillanceBody/surveillanceBody.resolver.js (sourcemap at surveillanceBody.resolver.js.map, debug id 40ce542b-e0ed-5859-b783-ce38ea6a886f)
~/src/modules/accident/surveillanceBody/surveillanceBody.service.js (sourcemap at surveillanceBody.service.js.map, debug id f34c0b0f-6a84-55f6-9e5f-ca9b53308e6c)
~/src/modules/accident/weather/weather.module.js (sourcemap at weather.module.js.map, debug id f36d228c-ceba-5a59-af5a-772b8c7e3c0a)
~/src/modules/accident/weather/weather.resolver.js (sourcemap at weather.resolver.js.map, debug id 8f557721-9c0d-5412-887f-5a67ebcbb8d5)
~/src/modules/accident/weather/weather.service.js (sourcemap at weather.service.js.map, debug id 0c09b155-c43a-57bf-9672-76fdbf3d8004)
and this is the one that created the sourcemaps locally and it works. https://insolite.sentry.io/issues/4914565311/events/a64a8df40ca24bc480e954fbc6309ad4/
Log sourcemap
> sentry-cli sourcemaps inject --release $(npm version | grep ora-back | tr -d ',' | tr -d "'" | sed 's/: /@/g') --org insolite --project ora-back ./dist && sentry-cli sourcemaps upload --release $(npm version | grep ora-back | tr -d ',' | tr -d "'" | sed 's/: /@/g') --org insolite --project ora-back ./dist
> Searching ./dist
> Found 294 files
> Analyzing 294 sources
> Analyzing completed in 0.009s
> Injecting debug ids
Source Map Debug ID Injection Report
Modified: The following source files have been modified to have debug ids
e7797a81-94e0-5d66-aa9d-6a5d881b9706 - ./dist/src/app.module.js
6442652f-62a4-5f57-bbde-fea7ddf87bbb - ./dist/src/graphql.schema.js
3f54c21e-64b3-5398-9c91-fdd5b80e359a - ./dist/src/main.js
b6bbd747-2f1b-552d-9a05-cba8e8480be8 - ./dist/src/modules/accident/accidents.module.js
83915e79-ed59-58c3-bf89-b925b77476b7 - ./dist/src/modules/accident/accidents.resolver.js
70ca6206-a56c-5640-b2ac-77c14eeea0eb - ./dist/src/modules/accident/accidents.service.js
b1f18650-1e8d-56fe-a861-9576c8b1c557 - ./dist/src/modules/accident/attentionAccident/attentionAccident.module.js
e3177786-ada8-5554-bf9b-f4e6e97ff2a4 - ./dist/src/modules/accident/attentionAccident/attentionAccident.resolver.js
f61887fc-0e59-5807-9c85-157800d8af10 - ./dist/src/modules/accident/attentionAccident/attentionAccident.service.js
c1ae5a06-0e49-546e-8196-2e2adfffacff - ./dist/src/modules/accident/conditionsDriving/conditionsDriving.module.js
0af64b7d-3a4e-585f-bda5-4b3e2438308f - ./dist/src/modules/accident/conditionsDriving/conditionsDriving.resolver.js
db648395-d367-54d3-ae2c-64db182580e4 - ./dist/src/modules/accident/conditionsDriving/conditionsDriving.service.js
d274e132-65ed-5121-ab87-e22e60d6e4d6 - ./dist/src/modules/accident/image/image.module.js
eb2feeb0-67f2-5b47-9908-31894109b9be - ./dist/src/modules/accident/image/image.resolver.js
cdfb6ab6-09b4-5596-bddd-2f9fc167d34b - ./dist/src/modules/accident/image/image.service.js
a11344c8-9e74-50b8-8b6e-d236a86845f2 - ./dist/src/modules/accident/luminosity/luminosity.module.js
bb5633d5-9deb-51a8-ad70-8950247a59ee - ./dist/src/modules/accident/luminosity/luminosity.resolver.js
80041dea-6ce6-5f58-9ac2-e4325e02589b - ./dist/src/modules/accident/luminosity/luminosity.service.js
5309f638-d21a-54eb-9798-8a25249f754b - ./dist/src/modules/accident/mediumKnowledge/mediumKnowledge.module.js
6ef832fd-aee3-5eba-b212-a4d500a07acb - ./dist/src/modules/accident/mediumKnowledge/mediumKnowledge.resolver.js
f8a85924-8015-5207-9a0a-083a13b356da - ./dist/src/modules/accident/mediumKnowledge/mediumKnowledge.service.js
2889a494-4906-550e-aa37-2bf24f779d5b - ./dist/src/modules/accident/surfaceCondition/surfaceCondition.module.js
9d9bdcbc-d9e8-5360-a2da-b79e40237fc9 - ./dist/src/modules/accident/surfaceCondition/surfaceCondition.resolver.js
3c1ee6e0-0458-541a-b7ab-aabdc5d6969f - ./dist/src/modules/accident/surfaceCondition/surfaceCondition.service.js
0281ad30-c11b-5533-9a8f-dd5bcf6d4d88 - ./dist/src/modules/accident/surveillanceBody/surveillanceBody.module.js
40ce542b-e0ed-5859-b783-ce38ea6a886f - ./dist/src/modules/accident/surveillanceBody/surveillanceBody.resolver.js
f34c0b0f-6a84-55f6-9e5f-ca9b53308e6c - ./dist/src/modules/accident/surveillanceBody/surveillanceBody.service.js
f36d228c-ceba-5a59-af5a-772b8c7e3c0a - ./dist/src/modules/accident/weather/weather.module.js
8f557721-9c0d-5412-887f-5a67ebcbb8d5 - ./dist/src/modules/accident/weather/weather.resolver.js
0c09b155-c43a-57bf-9672-76fdbf3d8004 - ./dist/src/modules/accident/weather/weather.service.js
30360742-0cf0-5f81-9f95-b42d440ccd80 - ./dist/src/modules/action/actions.module.js
55098bca-8628-5b20-b45e-320fe1dc2fef - ./dist/src/modules/action/actions.resolver.js
3813d172-e222-51af-a51d-79aec9a2e3ca - ./dist/src/modules/action/actions.service.js
71958786-a7f7-54bb-82be-1cc45591fceb - ./dist/src/modules/action/activity/activity.module.js
67560a67-3671-5a34-a9e9-b80ceb47e01f - ./dist/src/modules/action/activity/activity.resolver.js
0849780f-1ee2-5645-8dd7-b3fddce2a348 - ./dist/src/modules/action/activity/activity.service.js
d540d99a-de93-51dd-9504-0632df859aee - ./dist/src/modules/action/animal/animal.module.js
f802e2d6-e9ab-577f-a6a1-b542549ebb1e - ./dist/src/modules/action/animal/animal.resolver.js
858194cf-99dc-52b8-952a-cf534f147cb2 - ./dist/src/modules/action/animal/animal.service.js
0621e865-e545-5246-811b-fc506037c44b - ./dist/src/modules/action/animalUnit/animalUnit.module.js
73fe2615-38b8-5db9-b134-ba22a0c71883 - ./dist/src/modules/action/animalUnit/animalUnit.resolver.js
2841800e-6334-5170-a7d3-5686b1c58de4 - ./dist/src/modules/action/animalUnit/animalUnit.service.js
76870fe2-75df-526f-92d3-13ac1a1215bd - ./dist/src/modules/action/asset/asset.module.js
e72cc414-7f3a-5d1b-ab45-74cdc80b7c58 - ./dist/src/modules/action/asset/asset.resolver.js
4beb621a-541c-5968-ab38-59ed98a527e6 - ./dist/src/modules/action/asset/asset.service.js
22131423-dfa8-5614-9d63-8f051d171e7a - ./dist/src/modules/action/auxMachine/auxMachine.module.js
7445c2e7-a420-5640-a5e9-b5482b176856 - ./dist/src/modules/action/auxMachine/auxMachine.resolver.js
e21abe2a-a196-5b5e-8d90-3c52531d823b - ./dist/src/modules/action/auxMachine/auxMachine.service.js
bfeb5fce-b45f-51cb-a543-f34f5e535b63 - ./dist/src/modules/action/auxMachineUnit/auxMachineUnit.module.js
a8ae9d59-2a91-5ef6-ae18-c9c40391d0cb - ./dist/src/modules/action/auxMachineUnit/auxMachineUnit.resolver.js
cef455d8-4a57-57ce-b15f-c7a3488055e8 - ./dist/src/modules/action/auxMachineUnit/auxMachineUnit.service.js
c59b4bd0-d04f-52f6-95b3-18277702b301 - ./dist/src/modules/action/material/material.module.js
7da41bd0-97a4-5a93-8af1-eecc42f21528 - ./dist/src/modules/action/material/material.resolver.js
c962021d-a71c-5e9a-8aa2-c15f058dc754 - ./dist/src/modules/action/material/material.service.js
c8354c7c-7aac-5b5f-bd72-128514962c81 - ./dist/src/modules/action/materialUnit/materialUnit.module.js
25036d57-3794-5f83-947b-b56208fc62fd - ./dist/src/modules/action/materialUnit/materialUnit.resolver.js
1b1f7a85-161c-581f-83d6-3685d46a226e - ./dist/src/modules/action/materialUnit/materialUnit.service.js
> Found 294 files
> Analyzing 294 sources
> Analyzing completed in 0.011s
> Rewriting sources
> Rewriting completed in 0.019s
> Adding source map references
> Bundling completed in 0.051s
> Bundled 294 files for upload
> Bundle ID: e4cfc5b4-9a7d-56ee-9aed-b1be59fdf1d3
> Optimizing completed in 0.002s
> Uploading completed in 0.28s
> Uploaded files to Sentry
> Processing completed in 1.01s
> File upload complete (processing pending on server)
> Organization: insolite
> Project: ora-back
> Release: [email protected]
> Dist: None
> Upload type: artifact bundle
Source Map Upload Report
Minified Scripts
~/src/app.module.js (sourcemap at app.module.js.map, debug id e7797a81-94e0-5d66-aa9d-6a5d881b9706)
~/src/graphql.schema.js (sourcemap at graphql.schema.js.map, debug id 6442652f-62a4-5f57-bbde-fea7ddf87bbb)
~/src/main.js (sourcemap at main.js.map, debug id 3f54c21e-64b3-5398-9c91-fdd5b80e359a)
~/src/modules/accident/accidents.module.js (sourcemap at accidents.module.js.map, debug id b6bbd747-2f1b-552d-9a05-cba8e8480be8)
~/src/modules/accident/accidents.resolver.js (sourcemap at accidents.resolver.js.map, debug id 83915e79-ed59-58c3-bf89-b925b77476b7)
~/src/modules/accident/accidents.service.js (sourcemap at accidents.service.js.map, debug id 70ca6206-a56c-5640-b2ac-77c14eeea0eb)
~/src/modules/accident/attentionAccident/attentionAccident.module.js (sourcemap at attentionAccident.module.js.map, debug id b1f18650-1e8d-56fe-a861-9576c8b1c557)
~/src/modules/accident/attentionAccident/attentionAccident.resolver.js (sourcemap at attentionAccident.resolver.js.map, debug id e3177786-ada8-5554-bf9b-f4e6e97ff2a4)
~/src/modules/accident/attentionAccident/attentionAccident.service.js (sourcemap at attentionAccident.service.js.map, debug id f61887fc-0e59-5807-9c85-157800d8af10)
~/src/modules/accident/conditionsDriving/conditionsDriving.module.js (sourcemap at conditionsDriving.module.js.map, debug id c1ae5a06-0e49-546e-8196-2e2adfffacff)
~/src/modules/accident/conditionsDriving/conditionsDriving.resolver.js (sourcemap at conditionsDriving.resolver.js.map, debug id 0af64b7d-3a4e-585f-bda5-4b3e2438308f)
~/src/modules/accident/conditionsDriving/conditionsDriving.service.js (sourcemap at conditionsDriving.service.js.map, debug id db648395-d367-54d3-ae2c-64db182580e4)
~/src/modules/accident/image/image.module.js (sourcemap at image.module.js.map, debug id d274e132-65ed-5121-ab87-e22e60d6e4d6)
~/src/modules/accident/image/image.resolver.js (sourcemap at image.resolver.js.map, debug id eb2feeb0-67f2-5b47-9908-31894109b9be)
~/src/modules/accident/image/image.service.js (sourcemap at image.service.js.map, debug id cdfb6ab6-09b4-5596-bddd-2f9fc167d34b)
~/src/modules/accident/luminosity/luminosity.module.js (sourcemap at luminosity.module.js.map, debug id a11344c8-9e74-50b8-8b6e-d236a86845f2)
~/src/modules/accident/luminosity/luminosity.resolver.js (sourcemap at luminosity.resolver.js.map, debug id bb5633d5-9deb-51a8-ad70-8950247a59ee)
~/src/modules/accident/luminosity/luminosity.service.js (sourcemap at luminosity.service.js.map, debug id 80041dea-6ce6-5f58-9ac2-e4325e02589b)
~/src/modules/accident/mediumKnowledge/mediumKnowledge.module.js (sourcemap at mediumKnowledge.module.js.map, debug id 5309f638-d21a-54eb-9798-8a25249f754b)
~/src/modules/accident/mediumKnowledge/mediumKnowledge.resolver.js (sourcemap at mediumKnowledge.resolver.js.map, debug id 6ef832fd-aee3-5eba-b212-a4d500a07acb)
~/src/modules/accident/mediumKnowledge/mediumKnowledge.service.js (sourcemap at mediumKnowledge.service.js.map, debug id f8a85924-8015-5207-9a0a-083a13b356da)
~/src/modules/accident/surfaceCondition/surfaceCondition.module.js (sourcemap at surfaceCondition.module.js.map, debug id 2889a494-4906-550e-aa37-2bf24f779d5b)
~/src/modules/accident/surfaceCondition/surfaceCondition.resolver.js (sourcemap at surfaceCondition.resolver.js.map, debug id 9d9bdcbc-d9e8-5360-a2da-b79e40237fc9)
~/src/modules/accident/surfaceCondition/surfaceCondition.service.js (sourcemap at surfaceCondition.service.js.map, debug id 3c1ee6e0-0458-541a-b7ab-aabdc5d6969f)
~/src/modules/accident/surveillanceBody/surveillanceBody.module.js (sourcemap at surveillanceBody.module.js.map, debug id 0281ad30-c11b-5533-9a8f-dd5bcf6d4d88)
~/src/modules/accident/surveillanceBody/surveillanceBody.resolver.js (sourcemap at surveillanceBody.resolver.js.map, debug id 40ce542b-e0ed-5859-b783-ce38ea6a886f)
~/src/modules/accident/surveillanceBody/surveillanceBody.service.js (sourcemap at surveillanceBody.service.js.map, debug id f34c0b0f-6a84-55f6-9e5f-ca9b53308e6c)
~/src/modules/accident/weather/weather.module.js (sourcemap at weather.module.js.map, debug id f36d228c-ceba-5a59-af5a-772b8c7e3c0a)
~/src/modules/accident/weather/weather.resolver.js (sourcemap at weather.resolver.js.map, debug id 8f557721-9c0d-5412-887f-5a67ebcbb8d5)
~/src/modules/accident/weather/weather.service.js (sourcemap at weather.service.js.map, debug id 0c09b155-c43a-57bf-9672-76fdbf3d8004)
Hi, the first link to the issue that is not working is dead. Can you update it? Thanks!
sorry I broke the link, I've updated it
It seems like the event that has a proper stack trace has "debug IDs" (ie. a debug_meta field on the event payload), the event that doesn't have a proper stack trace doesn't. Debug IDs are injected into your files via the sentry-cli sourcemaps inject command. Please double check that you are actually deploying the files you ran that command on.
It is built on a GitHub action on Ubuntu, compressed with zip command and deployed on a Debian azure server.
zip --symlinks -r api-ora.zip ./*
At the time I reviewed the debugId issue, if there was something wrong but I didn't see anything wrong, could it be because of the compression?
could it be because of the compression?
Very unlikely. If you unzip one of the deployed archives. What do the first lines in the .ts files look like? You want to see something like: e._sentryDebugIds=e._sentryDebugIds||{}
Please look through this page: https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/#verify-your-source-files-contain-debug-id-injection-snippets
I have tried to have all the steps of the common map problems checked several times and still haven't figured out what's wrong.
Here is the debugId in sentry
Here we have the debugId in both .js and .map on the server
You have some dependency, node setting or mechanism that messes with stack traces. The recorded stack trace in the event has a .ts file but now in the screenshot and in your logs you have .js files.
The SDK and Sentry needs you to generate proper native JS stack traces: https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/#verify-you-arent-using-the-source-map-support-package
So if I have the source-map enabled and I end up using that package, for nestjs, then the best thing to do is to disable the sourceMap or not to upload the sourceMap, right?
If you want to see proper stack traces in sentry you need to disable source-map-support in production.
if I remove this to disable map generation, it is not able to upload files .js with debugIds. Is it like I have to generalise them in the IC and then deploy my app with another bundle without a map?
https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/typescript/?original_referrer=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F10379#1-generate-source-maps
"compilerOptions": {
"sourceMap": true,
"inlineSources": true,
// Set `sourceRoot` to "/" to strip the build path prefix from
// generated source code references. This will improve issue grouping in Sentry.
"sourceRoot": "/"
}
}
with what you told me about production without map and rewriteFramesIntegration, I managed to get it to be seen, I just need to mark the line properly haha.
You need to keep the source map generation! You just need to remove your dependency on source-map-support: https://www.npmjs.com/package/source-map-support
the nest build command installs the source-map-support package, I even deleted it by hand, the production app is built and the sourcemap is uploaded to sentry without this packete and it still doesn't show the fragments, it still identifies the .ts file where it fails and the sourcemaps are .js and .js.map. If I remove the maps from the production app, instead of going through debugId it goes through release and it almost works, it fails on the line that fails xD
https://insolite.sentry.io/issues/4920241225/events/9b79d8a8c05e48ceab775e3c642be1c0/
Yeah I unfortunately don't know how to assist further here. Your setup is patching error stack traces and our SDK needs the original ones. There is nothing we can do here.
the problem is supposed to be, that when it captures the error it is .ts and when it compares it in sentry it is .js and js.map, there are no other people that has happened the same, it should always be either .js or .ts, no? if I change the frame instead of .ts to .js the filename and abs_path with the rewriteFramesIntegration will work? is there any way to see or check with breakpoints in some gentry calback why it is taking the .ts files?
When you send errors to Sentry the stack traces should contain .js paths. Sentry then uses the source maps and source files you uploaded to turn them back into their .ts counterparts.
If you are sending .ts paths Sentry cannot map back to anything because you are already sending the original file paths, which Sentry has no information over.
In the end I didn't get it to pull in the future I will try again for now I will use it in the release form that almost looks good
Hello folks.
@tastafur, I had the same exact issue as you and it drove me mad, but I managed to get it working.
My project was initialized some time ago using NestJS CLI, just like yours I assume. By default, it had source-map-support in it's dev dependencies list, which I completely forgot.
The first step to make it work is uninstalling that sneaky little package.
yarn remove source-map-support
Next, you need to make sure that your app is not starting in production environment using nest start, because it injects source maps by itself (source code). One would think that just uninstalling source-map-support would be enough, since the package would not be found, but it did not work for me.
In production, I run my app with bare Node anyway and it took me far too long to realize I was using nest start in my "local production" setup. So make sure to try running with something like the following.
node dist/main
That two steps should make Sentry SDK successfully attach debug_id's to your JSON payloads. So, now check the Sentry dashboard if that is true by checking the JSON payload of an event and searching for that field.
If your source maps still don't work, you will probably see some of your code now displaying in Sentry anyway. But quickly you will realize that it is actually the transpiled JavaScript and not your original code. Check the path of the file, it probably starts with /src something and ends in .js. In order to correctly map it to the proper source map, you need to use the already mentioned rewriteFrames. This has done the trick for me:
Sentry.init({
...
integrations: [
rewriteFramesIntegration({
root: process.cwd(),
}),
],
...
})
This will add add app:/// prefix to your paths and remove the root directory. For me, the app is running inside /app/dist/ in the container.
Good luck, and thanks to Sentry support for helping me on this one via email.
Additionally, one little section in the Sentry JavaScript docs about this would have been very helpful and save me a lot of time of tiresome image rebuilding and mocking of errors (e.g. explain that if you see .ts files but no code, you probably have some other souce mapping, and why is it important to have your paths start with app://).
Thank you very much I will check what you said and I will fix it
I just realized you are using the @ntegral/nestjs-sentry package. This is not something we maintain. That package likely doesn't support debug IDs yet, so maybe you want to raise an upstream issue to implement that.
I've tested using that library and without using it, I think it doesn't influence it, it's just a wrapper to be used in nestjs
@akantic although I uninstall source-map-support it nest-cli installs it and then in the ci I delete by hand the node_modules of source-map-support so that the command "nest build" can not use it and still does not work well, I will test with what you told me but I think everything you said I already did it
although I uninstall source-map-support it nest-cli installs it
By installs it, do you mean it is automatically added to your package.json OR node_modules and your lock file?
The first one would seem very unusual. So I will just assume you mean the latter (you can find source-map-support in your lock file and node_modules folder after running yarn/npm install).
That is the same for me, because it is listed as a nest-cli's dependency, which you can not change and you should not delete it manually. But that is completely okay, because source-map-support does nothing in the build process, your source maps are generated by the TypeScript compiler and then the package is injected when you run nest start.
What you need to do is just make sure there is no source-map-support in your package.json (do not worry about node_modules), and then stop using nest start to run your app.
I add my script, how it runs on the server pm2 start dist/src/main.js --no-daemon and the steps I do in the IC to see if you see something that can help me, thanks
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build && npm run sentry:sourcemaps",
"generate:typings": "ts-node generate-typings.ts",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch & npm run generate:typings & npm run prisma:generate-typings-watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/src/main.js",
"prisma:generate-typings": "prisma generate",
"prisma:generate-typings-watch": "prisma generate --watch",
"prisma:shema-push": "prisma db push",
"prisma:shema-pull": "prisma db pull",
"lint": "tsc && eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"release:patch": "git tag -l | xargs git tag -d && npm version patch && git push origin && git push origin --tags",
"release:minor": "git tag -l | xargs git tag -d && npm version minor && git push origin && git push origin --tags",
"release:major": "git tag -l | xargs git tag -d && npm version major && git push origin && git push origin --tags",
"release:beta": "git tag -l | xargs git tag -d && npm version prerelease --preid=beta && git push origin && git push origin --tags",
"postinstall": "husky install",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --release $(npm version | grep ora-back | tr -d ',' | tr -d \"'\" | sed 's/: /@/g') --org insolite --project ora-back ./dist && sentry-cli sourcemaps upload --release $(npm version | grep ora-back | tr -d ',' | tr -d \"'\" | sed 's/: /@/g') --org insolite --project ora-back ./dist"
},
Ci Pipepline
name: CI BETA
on:
push:
tags:
- 'v[0-9].[0-9]+.[0-9]+-beta.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
environment:
name: 'beta'
url: https://api-beta.*.com/graphql
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Dependencies and Build
run: |
npm ci --omit=dev
rm -rf ./node_modules/source-map-support
NODE_ENV="beta" SENTRY_AUTH_TOKEN=${{ vars.SENTRY_AUTH_TOKEN }} npm run build
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'oraplatform-back'
slot-name: 'beta'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_BETA }}
package: .
- name: Zip all files for upload between jobs
run: zip api-ora-beta.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: api-ora-beta
path: api-ora-beta.zip
tsconfig.json
{
"compilerOptions": {
"resolveJsonModule": true,
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
"inlineSources": true,
// Set `sourceRoot` to "/" to strip the build path prefix
// from generated source code references.
// This improves issue grouping in Sentry.
"sourceRoot": "/"
},
"include": ["src/**/*"]
}
tsconfig.build.json
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
https://github.com/getsentry/sentry-javascript/issues/10379#issuecomment-1952191905 I would literally delete it so there would be no trace of it xD
npm ci --omit=dev
rm -rf ./node_modules/source-map-support
NODE_ENV="beta" SENTRY_AUTH_TOKEN=${{ vars.SENTRY_AUTH_TOKEN }} npm run build
I am not very familiar with Azure DevOps processes, but what comes to mind is to double check that you indeed start your app with pm2 node dist/src/main.js, since per quick look at the docs there is a default setting to use the start and not start:prod script, which in your case will just run nest start.
It's ok apure, you tell it the command you want it to execute and it executes that command and I've seen it from inside the machine that uses that command. I have configured it as you have commented to me, it looks like this and I pass you up to the event.
https://insolite.sentry.io/issues/4920241225/events/927fdbd9058345fdb5b0515e90792aa3/
I will continue testing, if with the information that I give you see something strange, I would appreciate it, thanks, greetings
@akantic Thanks a lot for posting an update, I had the same issues, and now it works. The crucial change in my case was also running with node node dist/src/main.js in prod - only then the exception stacktrace points to *.js files instead of *.ts files so that Sentry can map properly (check the stacktrace in the server/container logs and/or the minified raw stack trace of the Sentry event). It's mentioned here as well https://github.com/getsentry/sentry-javascript/issues/5455#issuecomment-1681779101 - if the stack trace points to the TypeScript files then it won't work.
I would also confirm - it's not a matter of @ntegral/nestjs-sentry, but whether the source maps are used to resolve the source file path too early in the process.