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(nextjs): Use Edge SDK for Edge bundles #6753

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

lforst
Copy link
Member

@lforst lforst commented Jan 12, 2023

Ref: #4206

In #6752 we added a small SDK for the Edge Runtime. This PR will inject the SDK into edge runtime bundles generated by Next.js, enabling users to call the Sentry SDK from within middleware and edge API routes. Both errors and performance will work with this change.

Testing this change is impossible with our current setup. I will create proper E2E tests when #6746 is merged.

@lforst lforst changed the title feat(nextjs): Add Edge Runtime SDK feat(nextjs): Use Edge SDK for Edge bundles Jan 12, 2023
@lforst lforst self-assigned this Jan 12, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.84 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 61.46 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.62 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.38 KB (0%)
@sentry/browser - Webpack (minified) 66.55 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.4 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.63 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.82 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.25 KB (-0.01% 🔽)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.26 KB (-0.01% 🔽)
@sentry/replay - Webpack (gzipped + minified) 38.5 KB (0%)

@@ -348,7 +350,7 @@ async function addSentryToEntryProperty(
* @param platform Either "server" or "client", so that we know which file to look for
* @returns The name of the relevant file. If no file is found, this method throws an error.
*/
export function getUserConfigFile(projectDir: string, platform: 'server' | 'client'): string {
export function getUserConfigFile(projectDir: string, platform: 'server' | 'client' | 'edge'): string | undefined {
Copy link
Member

Choose a reason for hiding this comment

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

does this mean users have to define a sentry.edge.config.js?

we have to update the docstring if this is the 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.

does this mean users have to define a sentry.edge.config.js?

They don't have to in the sense that something will crash, but they should if they want to capture events. We're even logging a warning that they should add the file in case they're using edge stuff.

we have to update the docstring if this is the case.

Thanks for pointing that out. I updated the docstring.

Base automatically changed from lforst-edge-sdk to master January 12, 2023 15:30
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.

Should we think about updating the wizard to generate a sentry.edge.config.js?

@lforst
Copy link
Member Author

lforst commented Jan 12, 2023

Should we think about updating the wizard to generate a sentry.edge.config.js?

Most definitely! Adding a special command that auto-generates the file probably makes sense. Getting the right dsn would be difficult though but we can just put some placeholder there and print a message that instructs to replace it.

@lforst lforst merged commit f22366d into master Jan 12, 2023
@lforst lforst deleted the lforst-use-edge-sdk-for-edge-bundles branch January 12, 2023 16:14
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.

2 participants