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.

sourcemap to error stack doesn't work

See original GitHub issue

follow this page How to apply source maps to error stack traces when using minified bundles I am throwing an exception in vite+vue3 project(src/App.vue)

try {
      throw 'Parameter is not a number!'
}
catch(err) {
      // error is not defined
      console.log(error)
} 

and add the following configuration in the file vite.config.ts and run npm run bulid to generate the sourcemap

export default defineConfig({
  plugins: [vue()],
  build: {
    sourcemap: true                                                                                                                                                                         
  },

In the end I got the sourcemap in the project folder,and configure nginx to point to this directory

dist
├── assets
│   ├── index.c447a54c.js
│   └── index.c447a54c.js.map
├── favicon.ico
└── index.html

Under this directory path, I execute curl and successfully upload the sourcemap to kibana

cd dist
curl -X POST "https://${kibana}/api/apm/sourcemaps" \
  -H 'Content-Type: multipart/form-data' \
  -H 'kbn-xsrf: true' \
  -H 'Authorization: ApiKey ${key}' \
  -F 'service_name="demo"' \
  -F 'service_version="1.0"' \
  -F 'bundle_filepath="assets/index.c447a54c.js"'  \
  -F 'sourcemap=@assets/index.c447a54c.js.map'

Response:

{
  "type":"sourcemap",
  "identifier":"\"demo\"-\"1.0\"",
  ...
}

But in kibana, the stack is not mapped to the code, as shown below image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:23 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
andriijascommented, Oct 18, 2022

Upgrading to 8.4 resolved our issues, thanks everyone for your time, effort and kindness ❤️

0reactions
axwcommented, Oct 18, 2022

Woohoo! Thanks @andriijas for reporting back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Printing error stack with source (from source map)
So this works: node --enable-source-maps somescript.js. But this won't: node somescript.js --enable-source-maps.
Read more >
1317962 - Sourcemap locations don't work in the stack trace.
I'm using Firefox 50 and enabled 'devtools.sourcemap.locations.enabled' in 'about:config'. I restarted Firefox and opened a Ember app. When I get an error I ......
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 >
4 Reasons Why Your Source Maps are Broken
4 Reasons Why Your Source Maps are Broken · Missing or incorrect source map directive · Missing original source files · Bad source...
Read more >
Navigate to stack trace does not work for typescript ... - YouTrack
Navigate to stack trace does not work for typescript with source maps ... WEB-10528 nodejs: file urls output to console that point to...
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