Skip to content

Commit 0544181

Browse files
committed
fix(astro): prevent sentry from externalized
1 parent 82d8fdb commit 0544181

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/astro/src/integration/index.ts

+13
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
8181
options.debug && console.log('[sentry-astro] Using default server init.');
8282
injectScript('page-ssr', buildServerSnippet(options || {}));
8383
}
84+
85+
// Prevent Sentry from being externalized for SSR.
86+
// Cloudflare like environments have Node.js APIs are available under `node:` prefix.
87+
// Ref: https://developers.cloudflare.com/workers/runtime-apis/nodejs/
88+
if (config?.adapter?.name.startsWith('@astro/cloudflare')) {
89+
updateConfig({
90+
vite: {
91+
ssr: {
92+
noExternal: ['@sentry/astro', '@sentry/node'],
93+
},
94+
},
95+
});
96+
}
8497
}
8598

8699
const isSSR = config && (config.output === 'server' || config.output === 'hybrid');

0 commit comments

Comments
 (0)