# APM Sourcemap relative path?

**URL:** <https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765>\
**Category:** APM\
**Tags:** rum, server\
**Created:** [May 21, 2020, 3:23pm UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765 "2020-05-21T15:23:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgrip](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mgrip](https://discuss.elastic.co/u/mgrip)\
**Post date:** [May 21, 2020, 3:23pm UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/1 "2020-05-21T15:23:41Z")

</div>

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](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](https://app.whatever.com/packs/app-bundle.js)", pages that use different subdomains like "[https://other.whatever.com/packs/app-bundle.js](https://other.whatever.com/packs/app-bundle.js)" do not match.

---

<div class="post-metadata">

**Author:** ![jalvz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jalvz/32/45613_2.png) [@jalvz](https://discuss.elastic.co/u/jalvz)\
**Post date:** [May 26, 2020, 12:21pm UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/2 "2020-05-26T12:21:25Z")

</div>

Hello,

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?

---

<div class="post-metadata">

**Author:** ![mgrip](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mgrip](https://discuss.elastic.co/u/mgrip)\
**Post date:** [May 26, 2020, 1:39pm UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/3 "2020-05-26T13:39:50Z")

</div>

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](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?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/f/bf39fc45272045f3bb737af4b49dc6bb9d16a9a5.png)

---

<div class="post-metadata">

**Author:** ![jalvz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jalvz/32/45613_2.png) [@jalvz](https://discuss.elastic.co/u/jalvz)\
**Post date:** [May 27, 2020, 8:57am UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/4 "2020-05-27T08:57:19Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![mgrip](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mgrip](https://discuss.elastic.co/u/mgrip)\
**Post date:** [May 27, 2020, 5:32pm UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/5 "2020-05-27T17:32:56Z")

</div>

I think I had the apm server endpoint url wrong 🤦‍♂️ 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

---

<div class="post-metadata">

**Author:** ![jalvz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jalvz/32/45613_2.png) [@jalvz](https://discuss.elastic.co/u/jalvz)\
**Post date:** [May 28, 2020, 7:40am UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/6 "2020-05-28T07:40:43Z")

</div>

Fantastic, happy to hear!

Let me know if something else comes up!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 18, 2020, 3:40am UTC](https://discuss.elastic.co/t/apm-sourcemap-relative-path/233765/7 "2020-06-18T03:40:43Z")

</div>

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