question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong stack trace with webpack

See original GitHub issue

I’m getting this:

TypeError: Cannot read property 'length' of undefined
    at t.handler (/var/task/webpack:/src/main.ts:16:38)
    at invoke (/var/runtime/node_modules/awslambda/index.js:285:5)
    at InvokeManager.start (/var/runtime/node_modules/awslambda/index.js:151:9)

I think the webpack: part should not be there.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

6reactions
tonyfromundefinedcommented, Nov 21, 2019

https://webpack.js.org/configuration/output/#outputdevtoolmodulefilenametemplate

here is the solution

module.exports = {
  output: {
    path: path.resolve(__dirname, './dist'),
    devtoolModuleFilenameTemplate: '../[resource-path]',
  },
}
1reaction
tonyfromundefinedcommented, Nov 28, 2019

If your webpack build environment is the same as your Node.js running environment (usually at development time), you can provide [absolute-resource-path] with the devtoolModuleFilenameTemplate option.

If it is different (using CI/CD), it is better to use relative paths. (ex: ../[resource-path])

And I decided to use Sentry’s Release feature. (upload webpack bundle and sourcemap file in Sentry in release time (in the CircleCI), Sentry merge them and show proper stack trace)

https://docs.sentry.io/workflow/releases

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack + Babel Wrong Line Numbers in Stack Trace
I'm building an application with Webpack and Babel. When the application runs into an error, it correctly lists the line number for the ......
Read more >
Webpack from Nothing - Stack Traces and Line Numbers that ...
Re-run Webpack and open up dev/index.html , then open the JavaScript console, and then click the “Preview” button: Image of a useless stack...
Read more >
Stack-traces showing source at line number where error ...
I'm using Webpack with Sentry and Serverless (AWS Lambda). Error stack-traces are showing up as source but the line numbers are from where ......
Read more >
How to apply source maps to error stack traces when using ...
Here's an example of an exception stack trace in the APM app when using minified code. As you can see, it's not very...
Read more >
DevTools Console stack trace does not take into account ...
I looked at your example and debugged it and it seems that Angular wraps thrown Error in try/catch block (see callWithDebugContext) when the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found