When you track frontend JavaScript (JS) errors, a stack trace is used to locate the error. Real User Monitoring (RUM) collects JS error stack traces and parses them using uploaded source map files. However, because RUM supports managing multiple versions of source map files, it is often difficult to accurately associate a JS file in an exception's stack trace with its corresponding source map file by filename alone. By using the RUM build tool plugin, you can inject a UUID into the bundled JS files and source map files to establish a bidirectional link. This allows RUM to automatically parse and display the stack trace when you open the exception details page, without having to manually select a source map file.
Prerequisites
Before using the plugin, complete the following preparations:
You have created a workspace and a Web or H5 RUM application in Cloud Monitor 2.0, and obtained the
workspaceandserviceId. For instructions, see Integrate a web or H5 application.Your build environment uses Node.js 20 LTS or Node.js 22 and later.
You have obtained an AccessKey ID and AccessKey secret. The account must have CMS permissions. The following is a minimum permission policy example:
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": "cms:GetRumSymbolFileParams", "Resource": "*" } ] }
Use the RUM build tool plugin
Webpack
Install the RUM Webpack build tool plugin npm package.
npm install -D @arms/rum-webpack-pluginIntegrate and configure the Webpack plugin.
For production builds, use
hidden-source-mapto avoid exposing the source map URL in the JavaScript output.const { rumWebpackPlugin } = require('@arms/rum-webpack-plugin'); module.exports = { mode: 'production', devtool: 'hidden-source-map', plugins: [ rumWebpackPlugin({ workspace: 'your-workspace', serviceId: 'your-rum-service-id', version: 'your-release-version', region: 'cn-hangzhou', accessKeyId: process.env.ALIBABA_CLOUD_ACCESS_KEY_ID, accessKeySecret: process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET, stsToken: process.env.ALIBABA_CLOUD_SECURITY_TOKEN, clearSourceMap: true, }), ], };Webpack skips source map processing and upload when
mode === 'development'orNODE_ENV === 'development'. Use a non-development build to upload production source maps.
Vite
Install the RUM Vite build tool plugin npm package.
npm install -D @arms/rum-vite-pluginIntegrate and configure the Vite plugin.
import { defineConfig } from 'vite'; import { rumVitePlugin } from '@arms/rum-vite-plugin'; export default defineConfig({ build: { sourcemap: true, }, plugins: [ rumVitePlugin({ workspace: 'your-workspace', serviceId: 'your-rum-service-id', version: 'your-release-version', region: 'cn-hangzhou', accessKeyId: process.env.ALIBABA_CLOUD_ACCESS_KEY_ID, accessKeySecret: process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET, stsToken: process.env.ALIBABA_CLOUD_SECURITY_TOKEN, clearSourceMap: true, }), ], });build.sourcemapcan be set totrueor'hidden'. Do not set it to'inline'.
Configuration reference
Field | Required for auto-upload | Default | Description |
| Yes | None | Cloud Monitor 2.0 workspace name. |
| Yes | None | RUM application Service ID. |
| Yes | No default | Application release version, used to isolate source maps across different builds. Use your actual release version or build number. |
| Yes | No default | RUM service region. |
| Yes | None | AccessKey ID for calling the upload policy OpenAPI. |
| Yes | None | AccessKey secret for calling the upload policy OpenAPI. |
| No | None | Security Token Service (STS) token to pass when using STS temporary credentials. |
| No |
| Deletes local |
Verify injection
Check source map files
When clearSourceMap: false, open a .map file in the build output directory. A correctly formatted debugId at the top level indicates that injection succeeded. Example:
{
"version": 3,
"file": "index.js",
"sources": ["webpack://app/src/index.ts"],
"sourcesContent": ["throw new Error('test');"],
"mappings": "AAAA",
"debugId": "e4f083d6-b8d8-4cae-a0ea-16f2e83a6be1"
}sourcesContent must be present and non-empty. If it is missing or empty, RUM may only be able to restore the file location and cannot display the source code context.
Check the browser runtime
Open the deployed page and run the following in the browser console:
window._armsRumDebugIds;If the returned object contains UUID mappings, the JavaScript files on the current page have registered a debugId. The plugin also registers the debugId in globalThis, self, global, document.defaultView, and accessible parent/top windows to support iframe and micro-frontend scenarios.
Check upload results
On the File Management page of your RUM application, verify that:
Source map files have appeared.
The file version matches the
versionconfigured in the plugin.The UUID matches the
debugIdin the build output.
FAQs
Build logs report that source map files cannot be found
Check whether your build tool is generating separate .map files. Do not use inline or eval source maps, and verify that the filenames and paths of JavaScript files and .map files have not been modified by post-processing scripts.
Upload succeeded but the exception details page does not display source code
Check in sequence:
Does the
.mapfile contain a non-emptysourcesContent?Does the
debugIdin the source map match the UUID reported in the exception stack trace?Do
workspace,serviceId,version, andregionmatch your target RUM application?Does the uploaded file appear on the File Management page of the target application?
Webpack is not uploading files
Confirm that neither mode nor NODE_ENV is set to development, and verify that external source map files are being generated.
Can I use a custom OSS bucket?
No. The upload endpoint and form parameters are returned by the OpenAPI. The plugin does not expose bucket configuration.
How do I prevent source maps from being deployed to the public internet?
For Webpack, use hidden-source-map. Also set clearSourceMap: true. The plugin deletes the corresponding local .map file after each successful upload.
I see an error that the current Node.js version does not support certain features
Upgrade your build environment to Node.js 20 LTS or Node.js 22 and later. The dependencies used by the Vite plugin do not support Node.js 18 or 21.
A source map file exceeds the size limit
A single source map file cannot exceed 50 MiB. You can reduce the file size through code splitting, reducing inline source content, or adjusting your build configuration. You must retain sufficient sourcesContent to display source code context.
Source map auto-matching fails when chunk URLs contain parentheses
When webpack chunk URLs contain special characters such as parentheses — for example, the route group format used by Next.js App Router (/app/(groupName)/page/) — ARMS cannot correctly parse the UUID from the binary_images field in the reported JS error. As a result, automatic source map matching fails. Chunk URLs without parentheses in the same exception are parsed normally.
This is a known ARMS parsing limitation. To avoid this issue, configure webpack to exclude parentheses from chunk naming paths. For example, rename Next.js route group directories to avoid the (groupName) format.
Release notes
We recommend that new users or users upgrading use the latest version 1.1.0. Version 0.0.x uses the legacy upload pipeline and is no longer recommended.
Version | Status | Description |
| Currently recommended | Requires explicitly passing a plugin configuration object. |
| Upgrade recommended | Switched the upload pipeline to the CMS |
| Not recommended | Uses the legacy upload pipeline. Extended |
| Not recommended | Uses the legacy upload pipeline. Added region selection and STS token support. |
| Not recommended | Uses the legacy upload pipeline. Added automatic source map upload after a project build. |
| Not recommended | Uses the legacy upload pipeline. Added Webpack and Vite support. Injects a UUID to create a bidirectional link between JavaScript files and their corresponding source map files. |
When upgrading from 0.0.x to 1.1.0:
You must explicitly pass a configuration object to the Webpack or Vite plugin and configure all required fields.
If your existing configuration uses
pid, replace it withserviceId.Explicitly configure
versionandregion. The plugin no longer provides default values.After upgrading from
0.0.x, the CMS OpenAPI upload pipeline will be used. Configureworkspace,serviceId, and AccessKey authentication as described in this document.