# SourceMaps don't show for all Errors

**URL:** <https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978>\
**Category:** APM\
**Tags:** rum\
**Created:** [November 29, 2019, 2:39pm UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978 "2019-11-29T14:39:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![akosanovic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akosanovic/32/58345_2.png) [@akosanovic](https://discuss.elastic.co/u/akosanovic)\
**Post date:** [November 29, 2019, 2:39pm UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/1 "2019-11-29T14:39:42Z")

</div>

Some errors are pointing to the **bundle.js** files event tho I have uploaded the Source Maps.

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

**Kibana version** : 7.1

**Elasticsearch version** : 7.1

**APM Server version** :

**APM Agent language and version** :

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:

**Fresh install or upgrade from other versions?** :

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

Using **Angular 5 /CLI 1.7.4** to generate Source Maps and

- Angular 5 app with `"@elastic/apm-rum": "^4.3.0",`
- Using Angular CLI 1.7.4 to generate Source Maps
- Using CURL to upload them all to APM cloud server

(code)

```
npm config set user root
npm config set user root
npm install -g @angular/cli@1.7.4
npm install
ng build --sourcemaps=true --prod
echo "Uploading sourcemaps..."
cd dist/
ls -l
echo "starting curl part"
for i in *.map
do
  MAPNAME=$i
  BASENAME=$(basename $i .map)
  curl -X POST https://ASDF.apm.eu-west-1.aws.cloud.es.io:443/assets/v1/sourcemaps \
  -H "Authorization: Bearer tokenxxxyyy" \
  -F service_name="simplesite-checkout-app" \
  -F service_version="1.0" \
  -F bundle_filepath="https://www.ASD.com/checkout/$BASENAME" \
  -F sourcemap=@./$MAPNAME
done
echo "Deleting sourcemaps..."
rm -rf *.map
```

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [December 2, 2019, 7:51am UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/2 "2019-12-02T07:51:11Z")

</div>

Hi @akosanovic, could you query for the error groups where you see references to a minified js and see what is stored in the `sourcemap` fields of those errors.

```auto
GET apm*error*/_search
{
  "query": {
    "term": {
      "error.grouping_key": {
        "value": "3fc00..."
      }
    }
  }
}

```

Check for `error` and `updated` in `error.exceptions.stacktrace.sourcemap.*`

---

<div class="post-metadata">

**Author:** ![akosanovic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akosanovic/32/58345_2.png) [@akosanovic](https://discuss.elastic.co/u/akosanovic)\
**Post date:** [December 2, 2019, 12:19pm UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/3 "2019-12-02T12:19:26Z")

</div>

Hi @simitt, thank you for your response.

I've looked over `*bundle.js` errors and they all have :

```
     "sourcemap": {
           "updated": true
     },

```

I'm new to APM so I'm not really sure what that means?

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [December 3, 2019, 8:00am UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/4 "2019-12-03T08:00:29Z")

</div>

This looks like the sourcemaps were applied from within the APM Server then. For every updated stacktrace frame there should be a group `original` storing information before applying the sourcemapping. Can you compare the values of `error.exceptions.stacktrace.[].sourcemap.original.filename` and `error.exceptions.stacktrace.[]sourcemap.filename`? They should have a different value. If they show the same value for a frame where `sourcemap.updated: true`, could you please verify the sourcemap you uploaded is actually valid?

---

<div class="post-metadata">

**Author:** ![akosanovic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akosanovic/32/58345_2.png) [@akosanovic](https://discuss.elastic.co/u/akosanovic)\
**Post date:** [December 3, 2019, 11:42am UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/5 "2019-12-03T11:42:53Z")

</div>

`error.exceptions.stacktrace.[].sourcemap.original.filename` and `error.exceptions.stacktrace.[]sourcemap.filename` are indeed showing the same values for each stacktrace with `sourcemap` being:

```
"sourcemap":{ 
   "updated":true
 },

```

Sourcemap seems valid, it's generated at the same time and looks like other sourcemaps.

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [December 3, 2019, 1:23pm UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/6 "2019-12-03T13:23:11Z")

</div>

That does sound as if either the sourcemap is not valid or missing a mapping for this stacktrace frame, or the [sourcemap library](https://github.com/go-sourcemap/sourcemap) we are using internally has a bug.

I cannot reproduce this issue locally, as the sourcemap functionality generally works as expected and I don't have a sourcemap file for which it doesn't. Is it possible for you to verify your sourcemap, e.g. by using another tool to validate and apply the sourcemap?

---

<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:** [December 24, 2019, 9:23am UTC](https://discuss.elastic.co/t/sourcemaps-dont-show-for-all-errors/209978/7 "2019-12-24T09:23:21Z")

</div>

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