Skip to content

fix(astro): Do not inject withSentry into Cloudflare Pages #19559

@github-actions

Description

@github-actions

Note

The pull request "fix(astro): Do not inject withSentry into Cloudflare Pages" was created by @JPeer264 but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.

When running on Cloudflare Pages the withSentry function got bundled and wrapped into the index.js. This actually didn't cause any problems during the runtime, but it just added unnecessary code into the bundle. This removes now the automatic wrapping, which is required for Cloudflare Workers only.

By adding the plugin sentryCloudflareNodeWarningPlugin we also remove tons of warnings like following when building for Cloudflare Pages:

11:20:40 [WARN] [vite] [plugin vite:resolve] Automatically externalized node built-in module "node:diagnostics_channel" imported from "node_modules/.pnpm/@sentry+node@10.40.0/node_modules/@sentry/node/build/esm/integrations/tracing/fastify/index.js". Consider adding it to environments.ssr.external if it is intended.
11:20:40 [WARN] [vite] [plugin vite:resolve] Automatically externalized node built-in module "node:diagnostics_channel" imported from "node_modules/.pnpm/@sentry+node-core@10.40.0_@opentelemetry+api@1.9.0_@opentelemetry+context-async-hooks@2_feb79575758996d9eeb93d3eb9a5534b/node_modules/@sentry/node-core/build/esm/integrations/http/httpServerIntegration.js". Consider adding it to environments.ssr.external if it is intended.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions