# JavaScript Source Map not working for error trace

**URL:** <https://discuss.elastic.co/t/javascript-source-map-not-working-for-error-trace/366876>\
**Category:** APM\
**Tags:** rum\
**Created:** [September 20, 2024, 11:48am UTC](https://discuss.elastic.co/t/javascript-source-map-not-working-for-error-trace/366876 "2024-09-20T11:48:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tabish\_Tariq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tabish_tariq/32/137758_2.png) [@Tabish\_Tariq](https://discuss.elastic.co/u/Tabish_Tariq)\
**Post date:** [September 20, 2024, 11:48am UTC](https://discuss.elastic.co/t/javascript-source-map-not-working-for-error-trace/366876/1 "2024-09-20T11:48:01Z")

</div>

Hi, I am using @elastic/apm-rum in react to trace errors.  
I have uploaded the source map to elastic rum and the sourcemaps are accessible at /api/apm/sourcempas  
But when an error occured, the error trace on kibana is shown in compile javascript form  
I have tried searching the internet and tried all the options discussed in [sourcemap to error stack doesn't work · Issue #1289 · elastic/apm-agent-rum-js · GitHub](https://github.com/elastic/apm-agent-rum-js/issues/1289)  
I also tried giving both relative and absolute path for bundle\_path but still it doesn't work  
I have also matched the service name and service version both are correct

Here is my script i am using to upload my sourcemaps to kibana:

```auto
for file in "$BUILD_DIR"/*.map; do
  # Extract the JS bundle file path by removing the .map extension
  bundle_filepath="${file%.map}"
   # Remove 'public' from the start of the file path
  relative_filepath="${bundle_filepath#./public/}"

  echo "Uploading sourcemap for bundle: $bundle_filepath.map"
  
  # Send the curl request to upload the sourcemap
  curl -X POST $API_URL \
    -H "Content-Type: multipart/form-data" \
    -H "kbn-xsrf: true" \
    -H "Authorization: ApiKey $AUTH_KEY" \
    -F "service_name=$SERVICE_NAME" \
    -F "service_version=$SERVICE_VERSION" \
    -F "bundle_filepath=$relative_filepath" \
    -F "sourcemap=@$bundle_filepath.map" \
    --max-time 6000
  
  echo "Uploaded $file"
done

```

Here is the command after putting example paths

```auto
curl -X POST https://<kibanadomain.com>:5601/api/apm/sourcemaps
		-H Content-Type: multipart/form-data
		-H kbn-xsrf: true
		-H Authorization: ApiKey $API_KEY
		-F service_name=<service_name>
		-F service_version=<service_version>
		-F bundle_filepath=zen/javascripts/react/build/taskForm.screen-7BSIKK63.js
		-F sourcemap=@./public/zen/javascripts/react/build/taskForm.screen-7BSIKK63.js.map
		--max-time 6000

```

============Version Info============  
Kibana: 8.11.3  
Elasticsearch: 8.11.3  
APM: 8.11.3  
APM agent: apm-rum javascript agent 5.16.0  
Install method: using deb  
Fresh install  
Nothing custom being done

---

<div class="post-metadata">

**Author:** ![Sharoze\_Meraj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharoze_meraj/32/116263_2.png) [@Sharoze\_Meraj](https://discuss.elastic.co/u/Sharoze_Meraj)\
**Post date:** [September 20, 2024, 11:52am UTC](https://discuss.elastic.co/t/javascript-source-map-not-working-for-error-trace/366876/2 "2024-09-20T11:52:49Z")

</div>

Facing same issue
