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

fix(nextjs): Exclude SDK from Edge runtime bundles #6683

Merged
merged 1 commit into from Jan 9, 2023

Conversation

lforst
Copy link
Member

@lforst lforst commented Jan 7, 2023

Ref #6120

Builds currently emit warnings when there is a route using the Vercel edge runtime because we are injecting code into the serverless bundles that is using APIs that are not WinterCG compatible or we are wrapping with code that uses server SDK functions even though we are injecting the client SDK.

Also resolves #5974

@lforst lforst force-pushed the lforst-exclude-sentry-from-edge-runtime-bundles branch from 3a307cf to ec34a01 Compare January 9, 2023 09:51
@lforst lforst requested review from mydea and Lms24 January 9, 2023 09:51
@lforst lforst marked this pull request as ready for review January 9, 2023 09:52
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

feels like a code smell that we have to scatter this check everywhere - but I guess no good way around it that doesn't require further refactoring

isServer,
userSentryOptions.excludeServerRoutes,
isDev,
buildContext.nextRuntime === 'edge',
Copy link
Member

Choose a reason for hiding this comment

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

l: Only thing I'd like to see here is the equality check extracted into a helper func, but nbd.

@lforst
Copy link
Member Author

lforst commented Jan 9, 2023

feels like a code smell that we have to scatter this check everywhere - but I guess no good way around it that doesn't require further refactoring

Honestly, I thought the exact same thing while making this change. Let me see if I can somehow clean this up a bit without too much effort, otherwise, I'll do it in a follow-up soon.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.84 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 61.46 KB (+0.03% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.62 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55 KB (+0.02% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.38 KB (-0.05% 🔽)
@sentry/browser - Webpack (minified) 66.55 KB (-0.14% 🔽)
@sentry/react - Webpack (gzipped + minified) 20.4 KB (-0.03% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.64 KB (-0.11% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.82 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.25 KB (0%)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43 KB (+0.03% 🔺)
@sentry/replay - Webpack (gzipped + minified) 38.25 KB (+0.04% 🔺)

@lforst
Copy link
Member Author

lforst commented Jan 9, 2023

Ok I think this is hopeless. This file needs a major refactoring.

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.

Throw warning if someone uses NextJS experimental-edge-runtime
2 participants