Sourcemaps not getting applied

We have a custom node app for uploading source maps and have provided all the required details like serviceName, serviceVersion, bundlePath to upload. We are getting success message for all the source maps but when we try to retrieve we don't see the source maps available and also not getting applied to errors.

Getting hits as 0 for the query =>

GET apm-*/_search
{
  "query": {
    "term": {
      "processor.event": "sourcemap"
    }
  }
}
{
  "took" : 37,
  "timed_out" : false,
  "_shards" : {
    "total" : 145,
    "successful" : 145,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

Could somebody please help out, have been trying to fix this for quite some time

Hi @skumar7,

Thanks for using the RUM agent!

I have a few questions:

  • What version of the RUM agent are you using?
  • What version of the Elastic Stack are you using?
  • Are you using the APM Server integration or the APM standalone server?
  • Could you show us the code you are using to upload the source maps? (please redact the sensitive information)

Apart from that, I would like to share with you this post where we explain how to upload a sourcemap step by step: Uploading sourcemaps from AIX webserver - #15 by Alberto_Delgado.

Cheers,
Alberto

1 Like

Hi Alberto,

Please find the required details below:

  • What version of the RUM agent are you using?
    agent

agent.name = rum-js
agent.version = 5.11.1

  • What version of the Elastic Stack are you using?
    elastic

observer.type = app-server
observer.version = 7.17.3
observer.version_major = 7

  • Are you using the APM Server integration or the APM standalone server?
    I think it is the APM standalone server but I am really not sure

Code used for uploading source maps:

import fetch from 'isomorphic-fetch';
import path from 'path';
import git from 'git-rev-sync';
import * as fsp from 'fs/promises';
import FormData from 'form-data';

const uploadFile = async ({ filePath, bundlePath }) => {
    const fileContent = await fsp.readFile(filePath, { encoding: 'utf-8' });

    const formData = new FormData();
    formData.append('service_name', options.name);
    formData.append('service_version', git.long());
    formData.append('bundle_filepath', `/${bundlePath}`); 
    formData.append('sourcemap', fileContent);

    return fetch(`${options.url}/api/apm/sourcemaps`, {
      method: 'POST',
      headers: {
        'Content-Type': `multipart/form-data;boundary="${formData.getBoundary()}"`,
        'kbn-xsrf': 'true',
        'Authorization': `ApiKey ${options.token}`,
      },
      body: formData,
    }).then(function (response) {
      if (response.status >= 400) {
        throw new Error(response.statusText);
      }
      return response.json();
    });
  };

Hi @skumar7,

Apologies for the delay!

Seeing that you are using APM server 7.17 and also APM standalone server you can try these two things:

  1. If you wanna keep uploading the sourcemaps to /api/apm/sourcemaps, make sure that you have configured the kibana section in your apm-server.yml. For instance:
apm-server.kibana.enabled: true
apm-server.kibana.host: "http://localhost:5601"
apm-server.kibana.username: "user"
apm-server.kibana.password: "pass"

and then upload them again.

  1. If first option doesn't work, try to upload the sourcemaps to the APM server endpoint. More info here: Source map upload API | APM User Guide [master] | Elastic

Cheers,
Alberto

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