@sentry/cloudflare/vite: Upload source maps from the Vite plugin
维护者通常 1 天内回复
@JPeer264 已经在做这个了。
开始于 2026年9月20日。
评估
这个 Issue 还没有评估数据。
描述
Description
@sentry/cloudflare/vite instruments the Worker, but it does not upload source maps. To get readable stack traces today, users add a second plugin themselves:
// vite.config.ts
import { cloudflare } from '@cloudflare/vite-plugin';
import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { defineConfig } from 'vite';
export default defineConfig({
build: { sourcemap: true },
plugins: [
cloudflare(),
sentryCloudflareVitePlugin(),
sentryVitePlugin({ org: '...', project: '...', authToken: process.env.SENTRY_AUTH_TOKEN }),
],
});
Two Sentry plugins for one Worker is easy to get wrong, and it leaves every Cloudflare-specific detail (below) to the user.
Proposal: let sentryCloudflareVitePlugin upload source maps itself, through an option:
sentryCloudflareVitePlugin({
sourceMapsUploadOptions: {
org: '...',
project: '...',
authToken: process.env.SENTRY_AUTH_TOKEN,
},
});
The plugin composes sentryVitePlugin from @sentry/bundler-plugins/vite, the same way @sentry/sveltekit, @sentry/solidstart, @sentry/nuxt, @sentry/react-router and @sentry/astro already do (see packages/sveltekit/src/vite/sourceMaps.ts). Upload stays opt-in: without an auth token, org and project, nothing is uploaded.
Cloudflare specifics the plugin should handle
- Enable source maps for the Worker build. The build needs
build.sourcemap, which many Cloudflare templates leave off. The plugin should turn it on (or warn) for the server environment. - Do not ship the maps. A Worker has a size limit, and the maps would be public. The maps must not end up in the deployed bundle or in the assets directory, so
sourcemaps.filesToDeleteAfterUpload(or the equivalent) must cover the generated server output. - Multiple Vite environments. A Cloudflare build produces the Worker environment plus client assets (and framework builds such as vinext add
rscandssr). The plugin should upload the ones that belong to this app and skip the rest. - Release must match the runtime release.
packages/cloudflare/src/options.tsresolves the release as: user option, thenSENTRY_RELEASE, then theCF_VERSION_METADATA.idbinding. The version metadata id only exists after the deploy, so a build-time upload under a different release name does not symbolicate. The plugin should document this and make the working combination easy, for example by requiring an explicitreleasein both places whenCF_VERSION_METADATAis used. - Wrangler's own
upload_source_maps. That option sends maps to Cloudflare, not to Sentry. The docs should say the two are independent, so users do not think one replaces the other. - Keep the upload out of the runtime graph.
@sentry/cliand the bundler plugin must not be reachable from the Worker bundle. See #23495, where a static re-export pulled them into the server graph.
Scope
sourceMapsUploadOptionsonSentryCloudflareVitePluginOptions, plus the composedsentryVitePlugin.@sentry/bundler-pluginsas a dependency of@sentry/cloudflare(already used by the framework SDKs listed above).- Tests: upload is off without credentials, the returned plugin list contains the upload plugin when configured, and the generated maps are deleted after upload.
- Docs: a Cloudflare source maps section, including the release caveat.
Notes
- Related but different: #19213 (OpenNext worker.js source maps) and #20051 (Nuxt on Cloudflare,
js_invalid_sourcemap_location). Both are about apps built by another framework toolchain, not about this plugin.
- 主要语言
- TypeScript
- 星标
- 8.8k
- 派生
- 1.9k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 514
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-javascript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 80/100
getsentry/sentry-javascript#24860 · 1 条评论 ·
维护者通常 1 天内回复
-
javascript
难度 2/5 1-3 小时 新手友好度 75/100
getsentry/sentry-javascript#24200 · 2 条评论 ·
维护者通常 1 天内回复
-
Confirm bun-integration-tests need no span streaming port可能已有人在做 @nicohrubec 于 1 天前认领。 未关闭javascript Task
难度 2/5 1-3 小时 新手友好度 82/100
getsentry/sentry-javascript#24134 · 1 条评论 ·
维护者通常 1 天内回复
-
Cloudflare Workers javascript Tests
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-javascript#24051 · 1 条评论 ·
维护者通常 1 天内回复
-
Elysia events report as `sentry.javascript.bun`可能已有人在做 @Shubham-Padkonde 于 15 天前认领。 未关闭Bug Bun javascript
难度 2/5 1-3 小时 新手友好度 92/100
getsentry/sentry-javascript#24045 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-javascript 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Effect-TS/effect#8728 · 1 条评论 ·
维护者通常 1 天内回复
-
check:passed streams:add
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 90/100
linagora/twake-drive-mobile#436 ·
维护者通常 1 天内回复
-
[Bug] The shared instance selector's placeholder and no-match text ignore the display language可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 90/100
apache/rocketmq-dashboard#5561 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 87/100
heygen-com/hyperframes#5002 ·
维护者通常 1 天内回复