APM Sourcemap relative path?

From the docs, it seems like the only way a RUM source map can be applied is by matching the full absolute path https://www.elastic.co/guide/en/apm/server/master/sourcemap-api.html#sourcemap-apply

Compare the stack trace frame’s abs_path with the source map’s bundle_filepath

Our application uses dynamic subdomains - is there a way to upload source maps using a relative path?

Right now, if we upload a source map with a bundle_filepath = "https://app.whatever.com/packs/app-bundle.js", pages that use different subdomains like "https://other.whatever.com/packs/app-bundle.js" do not match.


So the documentation there is not accurate, the APM Server does check for the URL path leaving out the scheme and host, so it should match anyways.

I will make a note to update the docs, but I can't reproduce the issue. Does it keep happening?
What APM Server version are you using?
Is it possible that you deployed a new version of your app, but didn't update the sourcemap, or something like that?

Oh ok great! In that case, I'm not sure what's going wrong then...

We're using the latest APM version (7.7). We added the source map upload as part of our build process using this package https://www.npmjs.com/package/elastic-apm-sourcemap-webpack-plugin, and from the logs it seems like there should be a source map available for the current version of our app.

This is the error we're seeing in our actual logs - any ideas how else to debug this?

Ok, so we can start checking if there is an actual sourcemap indexed (I assume there is, but is a good place to start).
A query to Elasticsearch like this one would help:

GET apm-*-sourcemap/_search
  "_source": ["observer", "@timestamp", "sourcemap.bundle_filepath"],
  "query": {
    "bool": {
        "must" : [
           "term": {
             "sourcemap.service.name": "frontend"
           "term": {
             "sourcemap.service.version": "54c282175..."

How many hits does that return? What is the bundle_filepath returned?

I think I had the apm server endpoint url wrong :man_facepalming: That query worked though! And once I updated the url, was able to confirm via that query the source maps were uploaded, and now I'm seeing the mapped logs in Kibana!

Thanks for helping me debug, this is super helpful

Fantastic, happy to hear!

Let me know if something else comes up!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.