Skip to content

Commit 05e9dff

Browse files
authored
feat(nuxt): Add warning when Netlify or Vercel build is discovered (#13868)
Depending on this (because of the link in the warning): getsentry/sentry-docs#11486
1 parent ddd753f commit 05e9dff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/nuxt/src/module.ts

+20
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,26 @@ export default defineNuxtModule<ModuleOptions>({
8888
});
8989
}
9090

91+
consoleSandbox(() => {
92+
const serverDir = nitro.options.output.serverDir;
93+
94+
// Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
95+
if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {
96+
// eslint-disable-next-line no-console
97+
console.warn(
98+
'[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',
99+
);
100+
}
101+
102+
// Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL
103+
if (serverDir.includes('.vercel') || !!process.env.VERCEL) {
104+
// eslint-disable-next-line no-console
105+
console.warn(
106+
'[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',
107+
);
108+
}
109+
});
110+
91111
if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {
92112
addServerConfigToBuild(moduleOptions, nuxt, nitro, serverConfigFile);
93113

0 commit comments

Comments
 (0)