-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nuxt): Add warning when Netlify or Vercel build is discovered #13868
Conversation
packages/nuxt/src/module.ts
Outdated
consoleSandbox(() => { | ||
const serverDir = nitro.options.output.serverDir; | ||
|
||
if (serverDir.includes('.netlify')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, just maybe, it's more robust to check for !!process.env.NETLIFY
: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would only show the warning in the Netlify console, right? I think it's also useful to have this warning locally when people choose to use the netlify build preset. But I can add a || !!process.env.NETLIFY
.
packages/nuxt/src/module.ts
Outdated
if (serverDir.includes('.netlify')) { | ||
// eslint-disable-next-line no-console | ||
console.warn( | ||
'[Sentry] Warning: The Sentry SDK discovered a Netlify build. The server-side Sentry support with ESM is experimental and may not work as expected. Please check out the docs for how to use Sentry on different deployment providers: https://docs.sentry.io/platforms/javascript/guides/nuxt/deployment-provider-setup/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, maybe:
'[Sentry] Warning: The Sentry SDK discovered a Netlify build. The server-side Sentry support with ESM is experimental and may not work as expected. Please check out the docs for how to use Sentry on different deployment providers: https://docs.sentry.io/platforms/javascript/guides/nuxt/deployment-provider-setup/', | |
'[Sentry] Warning: The Sentry SDK detected a build running on Netlify. The Sentry Nuxt SDK support for ESM is currently experimental and requires additional setup. Please check out the docs for how to use Sentry on Netlify: https://docs.sentry.io/platforms/javascript/guides/nuxt/deployment-provider-setup/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am no English major but I think you have support "for" something and not "with" something. It's less about the word "ESM".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lizokm hit us with the wisdom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's "for" :) You're right @lforst, it's "support for" you could say "with the support of..." but that's a different meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be great if we could detect when users actually set up everything correctly for the respective platform and not show the warning in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm...one thing we could do is getting the NODE_OPTIONS
variable and check if the file path is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea.
42b0aa1
to
b024239
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
packages/nuxt/src/module.ts
Outdated
if (serverDir.includes('.netlify') || !!process.env.NETLIFY) { | ||
// eslint-disable-next-line no-console | ||
console.warn( | ||
'[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 some errors may 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/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'[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 some errors may 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/', | |
'[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/', |
packages/nuxt/src/module.ts
Outdated
if (serverDir.includes('.vercel') || !!process.env.VERCEL) { | ||
// eslint-disable-next-line no-console | ||
console.warn( | ||
'[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK support for ESM on Vercel is currently experimental. Traces are not collected, but errors are 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/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering, isn't Nuxt always ESM? If that is the case, it may make sense then to just not call out ESM at all and just say that tracing doesn't work on Vercel:
'[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK support for ESM on Vercel is currently experimental. Traces are not collected, but errors are 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/', | |
'[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/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's always ESM - do you think it would still make sense to include this information somewhere? Like "The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel because of ESM on the server-side."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a user's perspective, I wouldn't care, since there is no way I can fix it. No strong opinions though. If you feel like it adds value, feel free to add a sentence like that.
08cfb85
to
344a093
Compare
Depending on this (because of the link in the warning): getsentry/sentry-docs#11486