# If there are multiple js files after build, how to upload them to APM server Make it valid on the Source Map

**URL:** <https://discuss.elastic.co/t/if-there-are-multiple-js-files-after-build-how-to-upload-them-to-apm-server-make-it-valid-on-the-source-map/322025>\
**Category:** APM\
**Tags:** rum, server\
**Created:** [December 27, 2022, 6:43am UTC](https://discuss.elastic.co/t/if-there-are-multiple-js-files-after-build-how-to-upload-them-to-apm-server-make-it-valid-on-the-source-map/322025 "2022-12-27T06:43:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ntmxglrtayl03](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ntmxglrtayl03/32/115075_2.png) [@ntmxglrtayl03](https://discuss.elastic.co/u/ntmxglrtayl03)\
**Post date:** [December 27, 2022, 6:43am UTC](https://discuss.elastic.co/t/if-there-are-multiple-js-files-after-build-how-to-upload-them-to-apm-server-make-it-valid-on-the-source-map/322025/1 "2022-12-27T06:43:57Z")

</div>

The example I saw from the official documentation was a single file upload ：

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/4/24b631ee47a5320b2085c8848a450bc52ee9afa4.png)

However, there will be multiple files after I build. How can I upload them? I tried to package only one file but got an error  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd73eb7f296a2e0932b69acb2bf3abad3abec642.png)

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/7/47ea0fdc2b64d837d00079df6ae61725dfeeda9e.png)

---

<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 27, 2022, 7:39am UTC](https://discuss.elastic.co/t/if-there-are-multiple-js-files-after-build-how-to-upload-them-to-apm-server-make-it-valid-on-the-source-map/322025/2 "2022-12-27T07:39:36Z")

</div>

Hi @ntmxglrtayl03 ,  
the endpoint only accepts one file upload per request. The easiest would probably be to write a small script where you iterate over all your sourcemaps and upload them one-by-one. The important part is to use a unique combination of `service_version`, `bundle_filepath` and `service_name` per service map, as these fields define the unique key with which source maps are fetched.

---

<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:** [January 17, 2023, 3:40am UTC](https://discuss.elastic.co/t/if-there-are-multiple-js-files-after-build-how-to-upload-them-to-apm-server-make-it-valid-on-the-source-map/322025/3 "2023-01-17T03:40:26Z")

</div>

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