Source Mapping
Flashduty CLI Source Management and Error Tracking
Overview
datadog-cli
that allows users to upload sourcemap
files to the Flashduty server. Through sourcemaps
, frontend developers can track and debug errors more efficiently. Users can view uploaded sourcemap
files in the "Application Management" - "Source Management" menu, and generate scripts for local execution through the upload panel. This document will provide detailed information about the purpose of sourcemaps
, methods for generating and uploading them, management approaches, and how to use sourcemaps
in the error tracking module to precisely locate issues.Why Do We Need SourceMaps?
SourceMap
files solve this problem:SourceMaps
record the mapping relationship between compressed code and original code, allowing developers to view uncompressed source code during debugging.SourceMaps
, you can directly locate specific positions in the original source code when tracking errors, not just in the compressed files.How to Generate and Upload SourceMaps?
Generating SourceMaps
SourceMaps
. Here's an example configuration using Webpack:1.
SourceMap
generation in webpack.config.js
:
2.
dist
directory will contain bundle.js
and its corresponding bundle.js.map
file.Uploading SourceMaps Using Flashduty CLI
sourcemaps
command for uploading sourcemap
files to the Flashduty server. Here are the specific steps:1.
flashcat-cli
via npm:
2.

In the Application Management - Source Management menu, click the "Upload Source" panel, fill in the following information, and generate an upload script:
test2
).my-service
).1.0.0
)./assets
).
3.
sourcemap
files are located in the specified path (such as the dist
directory). Flashduty CLI will upload the sourcemap
files to the server.
minified-path-prefix
matches the actual deployed path of your compressed files.sourcemap
files in Application Management - Source Management.How to Manage SourceMaps?
sourcemap
files are managed through the Application Management - Source Management menu:sourcemap
files, including file paths, service names, version numbers, sizes, and upload times.service
and release-version
parameters, you can manage sourcemaps
for different versions of your application, facilitating parallel debugging across multiple versions.API Key
, only authorized users can upload or manage sourcemaps
.How to View Source Code in the Error Tracking Module?
sourcemap
functionality, supporting direct viewing of original source code in the error tracking module for precise issue location. Here's the workflow:1.
2.
sourcemaps
, Flashduty automatically maps the error location in compressed code to the original source code./assets/index-5e0391ac.js
:Error: Something went wrong
at Object.<anonymous> (/assets/index-5e0391ac.js:1:123)
sourcemap
, mapped to original source code src/components/App.js
:Error: Something went wrong
at App.render (src/components/App.js:45:10)
3.
Something went wrong
.src/components/App.js:45:10
).4.
Best Practices
1.
flashcat-cli sourcemaps upload
command into your CI/CD pipeline to ensure automatic upload of sourcemaps
with each release.
2.
--release-version
parameter consistent with your application version number for easier tracking of specific sourcemap
versions.3.
sourcemap
files before uploading resources to CDN to avoid including source code information in the production environment.4.
sourcemaps
, proactively throw test errors to verify if the error tracking module can correctly map to source code.Common Issues
1. Why isn't the error stack mapping to source code?
sourcemaps
were successfully uploaded and that the minified-path-prefix
matches the actual deployment path.service
and release-version
match the application version when the error occurred.2. How to prevent SourceMaps from leaking sensitive information?
sourcemap
files are only uploaded to the Flashduty server and not directly exposed on the public internet.sourcemap
files (e.g., through Nginx configuration).3. What if uploading SourceMaps fails?
API Key
is valid.