Skip to content

feat(nextjs): Use Edge SDK for Edge bundles - #6753

Merged
lforst merged 4 commits into
masterfrom
lforst-use-edge-sdk-for-edge-bundles
Jan 12, 2023
Merged

feat(nextjs): Use Edge SDK for Edge bundles#6753
lforst merged 4 commits into
masterfrom
lforst-use-edge-sdk-for-edge-bundles

Conversation

@lforst

@lforstlforst commented Jan 12, 2023

Copy link
Copy Markdown
Contributor

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.

@lforstlforst changed the title feat(nextjs): Add Edge Runtime SDKfeat(nextjs): Use Edge SDK for Edge bundlesJan 12, 2023
@lforstlforst self-assigned this Jan 12, 2023
@github-actions

github-actionsBot commented Jan 12, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
@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%)

* @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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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 masterJanuary 12, 2023 15:30

@AbhiPrasadAbhiPrasad left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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 masterJan 12, 2023
@lforst
lforst deleted the lforst-use-edge-sdk-for-edge-bundles branch January 12, 2023 16:14
Sign up for freeto 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

@lforst@AbhiPrasad