I’m working with a NextJs (with Typescript) application and I’m trying to upload the sourcemaps to Sentry artifacts.
The build from this app is not bundled to a single file. Instead, the dist/output folder reflects the NextJs pages structure, which in this case has a tree structure similar to this:
All the .js files reference a .map file. For example, in /.next/static/buildId/index.js
, the last line is //# sourceMappingURL=index.js.map
.
Then, I’m uploading sourcemaps to Sentry with the following command:
docker exec -it wtr-admin_app_container yarn sentry-cli --auth-token=${SENTRY_AUTH_TOKEN} releases --org=${SENTRY_ORGANIZATION} --project=${SENTRY_PROJECT} files ${VERSION} upload-sourcemaps "./src/.next/static/" --url-prefix "~/_next/static/" --no-rewrite
The problem is about that --url-prefix
, which should be ~/_next/static/buildId/
for /.next/static/buildId/index.js
file but should be ~/_next/static/buildId/customer/[customerId]/
for /.next/static/buildId/customer/[customerId]/details.js
file.
So, uploading all files under the same url-prefix won’t work properly.
Is there any way of uploading this tree structure in a way where the .js files are correctly associated with its .map files?
Is RewriteFrames an option for this use case? If yes, can someone provide an example on how that can be implemented?