sentry-javascript
sentry-javascript copied to clipboard
Serverless Typescript source maps not working.
Environment
SaaS (https://sentry.io/)
Version
No response
Steps to Reproduce
Hello there 👋
I am having issues with getting source maps to work. I am experiencing issues with "Invalid location in sourcemap (see Troubleshooting for JavaScript)"
So far I have double checked:
- Artifacts have been uploaded to the sentry with release tag matching error release.
- Source maps works locally as per troubleshooting guide

How can I debug it further?
Kind regards, Marcin
Expected Result
Source maps are working for typescript based lambda
Actual Result
Webpack config:
const path = require("path");
const slsw = require("serverless-webpack");
const CopyPlugin = require("copy-webpack-plugin");
const SentryPlugin = require("@sentry/webpack-plugin");
const webpack = require("webpack");
module.exports = {
plugins: [
new webpack.SourceMapDevToolPlugin({
noSources: false,
filename: "[name].js.map",
}),
new SentryPlugin({
release: process.env.SERVICE_VERSION,
org: process.env.SENTRY_ORGANIZATION,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
include: ".webpack",
ignore: ["node_modules", "webpack.config.js"],
setCommits: {
auto: true,
},
deploy: {
env: process.env.SENTRY_ENV || "ENV_NAME_NOT_PROVIDED",
},
validate: true,
sourceMapReference: true,
}),
],
entry: slsw.lib.entries,
mode: "none",
target: "node14",
externals: ["aws-sdk"],
node: {
__dirname: true,
},
resolve: {
extensions: [".js", ".json", ".ts", ".tsx"],
},
optimization: {
minimize: false,
},
output: {
libraryTarget: "commonjs",
path: path.join(__dirname, ".webpack"),
filename: "[name].js",
},
ignoreWarnings: [
{
module: /node_modules\/typeorm/,
message: /Can't resolve/,
},
{
module: /node_modules/,
message: /Critical dependency: the request of a dependency is an expression/,
},
],
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: [/plop-templates/, /node_modules/],
use: [
{
loader: "ts-loader",
options: {
transpileOnly: process.env.NODE_ENV !== "dev",
},
},
],
},
{
test: /\.js$/,
exclude: [/node_modules/, /plop-templates/],
use: [
{
loader: "babel-loader",
},
],
},
],
},
};
Example sentry frame:
{
"function": "<anonymous>",
"module": "functions.test-sentry-tag-lambda:handler",
"filename": "/var/task/test-sentry-tag-lambda/handler.js.map",
"abs_path": "/var/task/test-sentry-tag-lambda/handler.js.map",
"lineno": 38803,
"colno": 18,
"context_line": "",
"in_app": true
},
Routing to @getsentry/team-web-sdk-frontend for triage. ⏲️
Hi, thanks for writing in! Can you post a link to a Sentry Error where sourcemaps aren't working?
Hi @lforst
I was able to solve the issue. Problem was that webpack generated source maps point to .js files not ts and sentry could not detect them in repo.
Kind regards, M