This repository provides two scripts for uploading an existing sourcemap.zip through OpenAPI:
upload-sourcemap.shupload_sourcemap.py
The scripts upload an already prepared zip file only. They do not generate or package sourcemaps.
For product background, SourceMap packaging requirements, parameter source instructions, and troubleshooting details, refer to the official documentation:
- Shell script:
bashcurljqsplitmktempwc
- Python script:
python3
Shell:
sh ./upload-sourcemap.sh \
--endpoint https://your-openapi-endpoint \
--api-key "$DF_API_KEY" \
--app-id app_id_from_studio \
--version 1.0.2 \
--env daily \
--file ./sourcemap.zip \
--need-cover truePython:
python3 ./upload_sourcemap.py \
--endpoint https://your-openapi-endpoint \
--api-key "$DF_API_KEY" \
--app-id app_id_from_studio \
--version 1.0.2 \
--env daily \
--file ./sourcemap.zip \
--need-cover trueExpected output:
Init succeeded, uploadId=...Uploading part x/yMerge succeeded via /api/v1/rum_sourcemap/part_mergeUpload complete
Required:
--endpoint: OpenAPI base URL--api-key:DF-API-KEY--app-id: RUM application ID--file: path tosourcemap.zip
Optional:
--version: application version--env: deployment environment, for exampledaily,gray, orprod--need-cover:trueorfalse, default isfalse--chunk-size-mb: multipart chunk size in MB, default is10, max is10--merge-path: custom merge endpoint path--cancel-path: custom cancel endpoint path
export DF_OPENAPI_ENDPOINT="https://your-openapi-endpoint"
export DF_API_KEY="your-api-key"
export DF_APP_ID="app_id_from_studio"
export DF_VERSION="1.0.2"
export DF_ENV="daily"
export DF_SOURCEMAP_FILE="./sourcemap.zip"
export DF_NEED_COVER="true"Then run:
sh ./upload-sourcemap.shOr:
python3 ./upload_sourcemap.py