I've tried to use source maps for making my errors readable and failed. The versions of my project and the source map are the same. The errors pile in in an unreadable format and my uploaded source maps are unused and unhappy. What does it take for the APM server to realise that it should use a source map?
Shell script for uploading source map manually
#!/bin/bash
# Find the main file with the latest version
main_file=$(ls -t ./build/static/js/main.*.js | head -1)
map_file=$(ls -t ./build/static/js/main.*.js.map | head -1)
echo "Uploading sourcemap for $main_file and $map_file"
curl -X POST "https://**aha**/api/apm/sourcemaps" \
-H 'Content-Type: multipart/form-data' \
-H 'kbn-xsrf: true' \
-F 'service_name=**aha**' \
-F 'service_version=gekkigheid' \
-F "bundle_filepath=static/js/bundle.js" \
-F "sourcemap=@$map_file"
Config for APM RUM agent
import { init as initApm } from "@elastic/apm-rum";
import env from "./env";
const setupApm = () => {
initApm({
// Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)
serviceName: "**aha**",
// Set custom APM Server URL (default: http://localhost:8200)
serverUrl: "http://**aha**:8200",
// Set service version (required for sourcemap feature)
serviceVersion: "gekkigheid",
environment: env.APM_ENVIRONMENT ?? "development",
});
};
export default setupApm;