Followed source map instructions, but line numbers are wrong, etc
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/node
- 5.18.1 -
@sentry/integrations
- 5.18.1 -
@sentry/webpack-plugin
- 1.11.1
Description
I’ve followed the instructions on source maps to the best of my knowledge. I’m trying this out with a Serverless Framework setup.
It’s quite an improvement over how reporting looked before I followed the steps, but the line number is totally wrong and the module name is missing. There’s also still remnants of webpack variable names.
https://sentry.io/organizations/reelcrafter/issues/1749922899/?project=5298557
webpack.config.js
const path = require("path");
// eslint-disable-next-line import/no-unresolved
const slsw = require("serverless-webpack");
const SentryPlugin = require("@sentry/webpack-plugin");
module.exports = {
entry: slsw.lib.entries,
devtool: "source-map",
output: {
libraryTarget: "commonjs",
filename: "[name].js",
path: path.join(__dirname, ".webpack"),
},
mode: "development",
target: "node",
module: {
rules: [
{
test: /\.js$/, // include .js files
enforce: "pre", // preload the jshint loader
exclude: /node_modules/, // exclude any and all files in the node_modules folder
include: __dirname,
use: [
{
loader: "babel-loader",
},
],
},
],
},
plugins: [
new SentryPlugin({
release: process.env.RELEASE,
include: "./.webpack",
}),
],
};
test.js
import * as Sentry from "@sentry/node";
import { RewriteFrames } from "@sentry/integrations";
Sentry.init({
dsn: "https://xx",
release: process.env.RELEASE,
integrations: [new RewriteFrames()],
});
/**
...
*/
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (9 by maintainers)
Top Results From Across the Web
Incorrect line numbers - sourcemaps, Webpack 2 Typescript
I have tried setting devtool to the following different options: //https://webpack.js.org/configuration/devtool/ //devtool: 'eval', //eval vert ...
Read more >Source map line numbers mismatch (Angular) - Elastic Discuss
I am using Angular 9 and elastic/apm-rum-angular version 1.1.6. I uploaded the source maps generated by running "ng build --source-map".
Read more >Debug Node.js Apps using Visual Studio Code
The JavaScript debugger of VS Code supports source maps that help debugging of transpiled languages, for example, TypeScript or minified/uglified JavaScript.
Read more >Is it safe to ship JavaScript Source maps to production?
With source maps, you can click on a certain line and column number in your generated JavaScript, and that will do a lookup...
Read more >Vue + TypeScript & Debuggers - ckh|Consulting
Restart your app, launch Chrome in debug mode again (through VS Code's debug screen), and navigate to the App.vue Source Map. You will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
😶
I found the main issue. It’s TerserPlugin messing around with the source code.
Add this to your webpack config and you should be good no matter what
mode
is set! (this is the only change I did base on your current repo state).You can play around with
TerserPlugin
default options to find which exactly is the culprit if you want to use it nonetheless - https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptionsAnytime, I’m curious myself what’s going in here 😄
For anyone who might still have problems with the source map line numbers while using Terser plugin, I could get it working properly by disabling the following compress options in
terserOptions
: