Skip to content

Instantly share code, notes, and snippets.

@mshwery
Created May 6, 2019 13:59
Show Gist options
  • Save mshwery/edbc9b93ea4314580a5fecb8d8b07f68 to your computer and use it in GitHub Desktop.
Save mshwery/edbc9b93ea4314580a5fecb8d8b07f68 to your computer and use it in GitHub Desktop.
Use Heroku's release feature to deploy Typescript NodeJS sourcemaps to Sentry. So you can properly debug transpiled Typescript files!
// After your import's
if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: 'production',
release: process.env.HEROKU_SLUG_COMMIT,
integrations: [
new Sentry.Integrations.RewriteFrames({
root: __dirname
})
]
});
}
release: bash ./release-sentry.sh
web: npm start
#!/bin/sh
npx sentry-cli releases --org $SENTRY_ORG --project $SENTRY_PROJECT files $HEROKU_SLUG_COMMIT upload-sourcemaps dist/ --no-rewrite --validate
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowJs": true,
"moduleResolution": "node",
"outDir": "dist"
},
"include": [
"./src/**/*"
]
}
{
"extends": "./tsconfig",
"compilerOptions": {
"sourceMap": true,
"inlineSources": true,
"sourceRoot": "/"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment