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(sveltekit): Flush in server wrappers before exiting #9153

Merged
merged 5 commits into from
Oct 4, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Oct 2, 2023

When deploying to Vercel (non-edge), server code is converted into Lambda functions. These functions have a tendency to freeze/shut down before the SDK is able to flush out events, causing events to be dropped. We already handle this in NextJS by manually calling flush. This PR applies the (almost) same logic to SvelteKit's server side instrumentation.

Since I was already at it, I replaced the trace calls with startSpan which is the newer API.

fixes #8855

@Lms24 Lms24 marked this pull request as draft October 2, 2023 16:23
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 84.24 KB (0%)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.41 KB (0%)
@sentry/browser - Webpack (gzipped) 22 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 78.69 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.52 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.59 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 254.14 KB (0%)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 86.42 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 61.23 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.38 KB (-0.01% 🔽)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 84.27 KB (0%)
@sentry/react - Webpack (gzipped) 22.05 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 102.23 KB (-0.02% 🔽)
@sentry/nextjs Client - Webpack (gzipped) 50.98 KB (-0.04% 🔽)

@Lms24 Lms24 requested review from AbhiPrasad and mydea October 3, 2023 16:23
@Lms24 Lms24 marked this pull request as ready for review October 3, 2023 16:23
@Lms24 Lms24 changed the title fix(sveltekit): Flush in Serverless functions before exiting fix(sveltekit): Flush in server wrappers before exiting Oct 3, 2023
@Lms24 Lms24 merged commit 945d873 into develop Oct 4, 2023
44 checks passed
@Lms24 Lms24 deleted the lms/sveltekit-fix-flush branch October 4, 2023 13:21
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.

Sveltekit server-side exceptions outside the handle hook are not correctly captured in a Vercel deploy
2 participants