sentry-javascript-bundler-plugins: `ERROR: Unexpected ";"` when using sentryVitePlugin
Environment
Using: "@sentry/vite-plugin": "^2.2.0"
Framework: "@sveltejs/kit": "1.20.0"
This is the config i’m using for the plugin:
sentryVitePlugin({
org: 'my-org',
project: 'my-project',
authToken: env.SENTRY_AUTH_TOKEN,
sourcemaps: {
ignore: ['node_modules', 'vite.config.ts'],
// Specify the directory containing build artifacts
assets: './.svelte-kit/**'
}
})
Steps to Reproduce
- Built my project
Expected Result
Build should complete with no syntax error. This has happened for over a week now. We use dependabot, so a new build runs every time the plugin gets an update.
Actual Result
It seems like Sentry is injecting some code that causes a syntax error in the transformed code.
rendering chunks (46)...[vite:esbuild-transpile] Transform failed with 1 error:
chunks/navigation.js:49:38: ERROR: Unexpected ";"
Unexpected ";"
47 | * @returns {void}
48 | */
49 | const afterNavigate = /* @__PURE__ */ ;!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="21ba7d35-8a1d-4997-1126-b7ce028af103",e._sentryDebugIdIdentifier="sentry-dbid-21ba7d35-8a1d-4997-1126-b7ce028af103")}catch(e){}}();client_method('after_navigate');
| ^
50 |
51 | export { afterNavigate as a, beforeNavigate as b };
✓ built in 11.84s
error during build:
Error: Transform failed with 1 error:
chunks/navigation.js:49:38: ERROR: Unexpected ";"
at failureErrorWithLog (/tech/frontend/node_modules/esbuild/lib/main.js:1636:15)
at /tech/frontend/node_modules/esbuild/lib/main.js:837:29
at responseCallbacks.<computed> (/tech/frontend/node_modules/esbuild/lib/main.js:697:9)
at handleIncomingPacket (/tech/frontend/node_modules/esbuild/lib/main.js:752:9)
at Socket.readFromStdout (/tech/frontend/node_modules/esbuild/lib/main.js:673:7)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 38 (20 by maintainers)
Let’s thank @jdk2pq for this 😄
Please check out version
2.2.2of the package which should have the fix for this issue!@jdk2pq Yup that seems to be it. Thank you so much!
Pretty sure this is the fix:
https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/013f7ff05ca95dcbdacff1b533fd533c02e44ef4/packages/bundler-plugin-core/src/index.ts#L345-L347
It is happening locally and in CI/CD. It does not matter if I do it in Docker with an Ubuntu image, with an Alpine image, or in my Mac machine
Confirmed that we (@jdk2pq) have 2.2.0 for both as well.
We have the exact same issue and error with a Vue 3 application. Strangely, we have no issues building the project locally, but when it gets built in our AWS CodeBuild CD environment, we see the error above, but with the Maska dependency