sentry-javascript-bundler-plugins: Sourcemaps not available after successful Sentry vite-plugin upload
Environment
What version are you running? Etc.
$ npm version
{
npm: '9.6.7',
node: '20.3.1',
...
}
$ npm ls -D vite @sentry/vite-plugin rollup
├── @sentry/vite-plugin@2.5.0
├─┬ @vitejs/plugin-react@4.0.3
│ └── vite@4.4.7 deduped
├─┬ vite-plugin-eslint@1.8.1
│ └── vite@4.4.7 deduped
├── vite@4.4.7
├── rollup@3.26.3
vite.config.js:
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import { sentryVitePlugin } from "@sentry/vite-plugin";
export default defineConfig(() => {
return {
base: '/myproject/',
plugins: [
react(),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "myorg",
project: "my-project",
url: "https://sentry-selfhosted.example.org/",
debug: true,
release: {
name: "my-test-release",
setCommits: {
auto: true,
}
},
}),
],
build: {
outDir: 'build',
sourcemap: true,
target: browserslistToEsbuild(),
},
};
});
Steps to Reproduce
I just ran an npm run build, which does a vite build
Expected Result
A release is created, commits are added, and bundled sources and sourcemaps from the build are uploaded and associated with the release.
Actual Result
The release was created, as were the commits.
Locally, the source bundle files and sourcemaps were identified and - according to the logs - successfully uploaded.
In the UI however, there were no artifacts. Looking at the release page for the newly created release, it claimed to have some artifacts:
Clicking on the link, or navigating to the project’s sourcemaps page however, the sourcemaps archive for the release was present, but empty (artifacts -1):
Relevant npm build logs:
[sentry-vite-plugin] Debug: No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.
build/index.html 3.15 kB │ gzip: 1.43 kB
build/assets/index-5fa0a054.css 263.86 kB │ gzip: 36.77 kB
build/assets/index-062d6867.js 1,297.09 kB │ gzip: 451.66 kB │ map: 6,511.39 kB
(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
> Found 2 files
> Analyzing 2 sources
> Analyzing completed in 0.009s
> Adding source map references
> Bundling completed in 0.239s
> Bundled 2 files for upload
> Bundle ID: e106fb55-4dc7-5583-b0e2-87d0983ab202
> Optimizing completed in 0.012s
> Uploading completed in 0.542s
> Uploaded files to Sentry
> Processing completed in 0.163s
> File upload complete (processing pending on server)
> Organization: dpa
> Project: nextar-frontend
> Release: 00002-8b0576e
> Dist: None
> Upload type: artifact bundle
Source Map Upload Report
Minified Scripts
~/3d13895f-7dfc-4882-9a3d-6a322b0f3d6f-0.js (sourcemap at index-062d6867.js.map, debug id 3d13895f-7dfc-4882-9a3d-6a322b0f3d6f)
Source Maps
~/3d13895f-7dfc-4882-9a3d-6a322b0f3d6f-0.js.map (debug id 3d13895f-7dfc-4882-9a3d-6a322b0f3d6f)
[sentry-vite-plugin] Info: Successfully uploaded source maps to Sentry
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (5 by maintainers)
只要满足下列条件,所有上传的sourcemap将不会作为Release Bundles。
Release Bundles是个历史功能,以往sourcemap是与版本强绑定的,一个版本只允许存在一套sourcemap。23.6.2开始使用Artifact Bundles的方式管理工件。根据官方文档的解析,插件在上传sourcemap时会对当前构建的每个代码文件生产全局唯一的Debug ID,并改动已构建的代码,往里面插入以
e._sentryDebugIds=e._sentryDebugIds||{}开始的代码,以标识该文件的Debug ID。这意味着版本不再与sourcemap强绑定,一个版本是可以存在多套sourcemap的。 所以上面有个老哥跟你说you can basically ignore release bundles.补充:我猜如果在先把代码发布至生产环境,再上传sourcemap,或许就对应不上了。sentry cli或者plugin在上传时插入的Debug ID代码并没有被发布出去。
https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/
Well, the interesting bit is that the archive files were present in the shared data directory. But somehow, despite the assemble call, Sentry didn’t seem to be aware of them.
But I guess with newer versions working, it’s a bit of a moot point 😅