Sourcemaps are not getting applied

Hello, I have been having problems with RUM agent. Stack traces are not shown. In Kibana there is just "stack trace is not available".

In APM server I can see this error:

2020-08-11T09:35:34.035+0200 WARN [stacktrace] model/stacktrace.go:62 Cannot apply sourcemap without a service name or service version

but it gets accepted ...

2020-08-11T11:04:36.599+0200 INFO [request] middleware/log_middleware.go:97 request accepted {"request_id": "52d735b4-45a2-4252-b7b8-a5e3a5308184", "method": "POST", "URL": "/intake/v2/rum/events", "content_length": 19119, "remote_address": " ", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)", "response_code": 202}

This is what apm-server.yml looks like:


enabled: true

apm-server.rum.enabled: true

apm-server.rum.source_mapping.enabled: true

apm-server.rum.allow_origins: ['*']

apm-server.rum.source_mapping.index_pattern: "apm-*"

And this is .js that we use to configure sourcemaps:



// Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)

serviceName: 'FrontEnd',

// Set custom APM Server URL (default: http://localhost:8200)

serverUrl: 'https://FrontEnd.pls.lab:8443/apm/',

// Set service version (required for sourcemap feature)

serviceVersion: '',

//logLevel: 'debug'

I have played with apm-config a little, I have tried to put something into serviceVersion: ... but nothing happens, chunk.js files didn't have full path in "//# sourceMappingURL=" so I added full path to the sourceMaps ... its still the same and still same error that It cant apply sourcemaps, so in Kibana its just "no stack trace available"

I am lost ... Nothing I tried helps. I would be grateful for any suggestions.

Thank you.

Whole elastic stack is on 7.8


Just to make sure because you don't explicitly mention it: Sourcemaps need to be uploaded to APM Server first. Did you follow instructions in

If so, what result are you seeing from executing the request?
You can also search the apm-sourcemap index in Elasticserch: do you get any hits?


Thank you for reply,

Sourcemaps should be getting uploaded via custom app.
I have searched apm-sourcemap index and this is what I see:

GET apm-*/_search
  "query": {
    "term": {
      "processor.event": "sourcemap"

  "took" : 7,
  "timed_out" : false,
  "_shards" : {
    "total" : 172,
    "successful" : 172,
    "skipped" : 0,
    "failed" : 0
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    "max_score" : null,
    "hits" : [  ]

so does it mean sourcemaps are not really in our apm-server ?
Can be serviceVersion empty ? serviceName is set.

Thank you.


You found it, serviceVersion can't be empty, so your upload request is failing (presumably silently).
You need to upload your sourcemaps with a serviceVersion matching the one you use for configuring the agent, see: and

Normally setting the version is optional, but when using sourcemaps it is important to version the software so we can know which sourcemap to use for each release.

So pass in a version (it can be Semver, a Git hash, whatever), use the same one when initializing the agent, and run that query against Elasticsearch again to confirm it was uploaded.

Hope this helps!

1 Like


Interesting ... When I check Kibana for some errors and I open it's metadata, I can see all that is needed but I still see the error message in apm logs and without stack trace.

###### Service

| --- | --- |

This is just info about the agent configuration ?

Sometimes I get confused about output from my GET requests, does my request for getting sourcemaps mean that they are not in apm-server as value for "hits": is 0 ?

Thank you for advice Juan.

So the way it works is that you use the APM Server Sourcemap API linked above to POST sourcemaps to APMServer. APM Server will validate them and index the in Elasticsearch.
So yes, if you GET request to search sourcemaps in Elasticsearch returns 0 hits, it means that something went wrong and nothing was uploaded. That might be because e.g. a connection problem between APM Server and Elasticsearch, or a validation failure (like no service version given).

Once you have a correct sourcemap uploaded, errors coming from then on will have readable stack traces. But the fix is not retroactive: you won't be able to see stack traces from errors ingested before the sourcemap has been uploaded.

I hope that makes sense.

Hello Juan,

You are the absolute King.
Error "cannot apply sourcemaps" dissappeared.

I have also found out that our source maps don't have mappings, therefore they can't be uploaded to apm-server. But this is not elastic issue, Long story short - it is issue during generation sourcemaps. (with wrong JS version as I was told by our devs).

I was looking for a root cause for this for a pretty long time, so your advice was extremely helpful.

Thank you very much.


Happy to hear you figured it out. Let me know if new issues arise!

Hello again Juan,
It seems like issue is not fixed after all :frowning:

I want to check if sourcemaps were correctly uploaded this time (after I manually uploaded them and got no errors during uploading). When I try to check them in in Kibana, I get error
"Too much recursion"

GET apm-*/_search
  "query": {
    "term": {
      "processor.event": "sourcemaps"

Errors look like this:
Dev Tools Console output
Unknown Request Error
too much recursion


in addition, new indices are now being named only as (for example) "apm-7.8.0-2020-26.08" instead of them having some specification what exactly it is ... (error, transaction, span ...).


Have you ever seen anything like this?

Thank you.


As for the crash: you are hitting, that will be fixed in 7.9.1 I believe. In the meanwhile, go to the settings tab in the console and disable the option saying "Use triple quotes in output pane".

As for the index names. Can you recall what changed since the indices had the right names? Did you redeploy apm-server, updated apm-server or agent version, etc?
Running apm-server -e setup template should hopefully get it back on track.

Hope that helps!

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