Issue
Source maps work when I start my Node.js app with node, but they stop working when I run the same app with PM2. Events may lack Debug IDs, or show line numbers without source context.
Applies To
All SaaS Customers and Self-Hosted Users
Node.js SDK
Source maps / Debug IDs
PM2 (not built or maintained by Sentry)
Symptoms
Source maps only work when running the app with
nodeEvents lack Debug IDs
Events show proper line numbers but no source code
Resolution
PM2 enables source-map-support by default. That package resolves source maps in the Node process before the Sentry SDK sends the event. Stack frames then leave your app already rewritten, so Sentry cannot apply your uploaded source maps or Debug IDs on the server.
If you want Sentry to resolve source maps, disable PM2’s source-map support.
In an ecosystem file:
module.exports = {
apps: [
{
name: "my-app",
script: "./dist/index.js",
disable_source_map_support: true,
},
],
};
Or via the PM2 CLI:
pm2 start ./dist/index.js --disable-source-map-support
After changing the setting, restart the PM2 process and send a new error to confirm Debug IDs / source context appear again.
See Sentry’s note on avoiding source-map-support when uploading maps: Node.js source maps troubleshooting. PM2 options are documented in the PM2 ecosystem file reference (not built or maintained by Sentry).
