Skip to content
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 build is discovered #13868

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Oct 4, 2024

Depending on this (because of the link in the warning): getsentry/sentry-docs#11486

@s1gr1d s1gr1d marked this pull request as draft October 4, 2024 12:51
consoleSandbox(() => {
const serverDir = nitro.options.output.serverDir;

if (serverDir.includes('.netlify')) {
Copy link
Member

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

Copy link
Member Author

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.

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/',
Copy link
Member

@lforst lforst Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk, maybe:

Suggested change
'[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/',

Copy link
Member Author

@s1gr1d s1gr1d Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "with ESM" is more fitting because when you extend it, it would be "with ECMAScript Module syntax" and "for" sounds a bit off in this context. I did a quick search and I got more results with "with":

Edit: Okay, thinking about it "for" sound okay too when you look more at "support for" 😅

image

Copy link
Member

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".

Copy link
Member

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

Copy link

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants