apm-agent-rum-js: sourcemap to error stack doesn't work

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (9 by maintainers)

Commits related to this issue

Most upvoted comments

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