Skip to content

fix(sveltekit): Detect sentry release before creating the Vite plugin #7902

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

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 19, 2023

In a SvelteKit production build, an error was thrown if the sentry-cli wasn't able to detect a release (for instance because the project is not in a git repo). This PR fixes this by detecting a release value before creating the plugin. The detection mechanism is identical to the mechanism in the NextJS SDK, with the exception of the fallback:

  • Try to detect a git commit hash. If this fails,
  • return a generated UUID

In NextJS, we just fall back to Next's internal build id. SvelteKit doesn't have such an Id, which is why ultimately, we just generate a UUID instead. However, I'd argue we want to first attempt detecting a commit hash as it is less random and the Sentry CLI does it as well.

@Lms24 Lms24 requested review from a team, mydea and lforst and removed request for a team April 19, 2023 11:27
@Lms24 Lms24 force-pushed the lms/sveltekit-fix-release-detection branch from 274511f to 9243382 Compare April 19, 2023 11:29
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.97 KB (-0.35% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 65.48 KB (-0.28% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.51 KB (-0.4% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 57.94 KB (-0.31% 🔽)
@sentry/browser - Webpack (gzipped + minified) 21.11 KB (-0.35% 🔽)
@sentry/browser - Webpack (minified) 68.89 KB (-0.26% 🔽)
@sentry/react - Webpack (gzipped + minified) 21.14 KB (-0.35% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.98 KB (-0.15% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.54 KB (-0.27% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.77 KB (-0.3% 🔽)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 45.35 KB (+0.01% 🔺)
@sentry/replay - Webpack (gzipped + minified) 39.28 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 64.22 KB (-0.12% 🔽)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 57.19 KB (-0.13% 🔽)

@Lms24 Lms24 merged commit 3040a6b into develop Apr 19, 2023
@Lms24 Lms24 deleted the lms/sveltekit-fix-release-detection branch April 19, 2023 13:34
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