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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(astro): Add sentryAstro integration #9218

Merged
merged 10 commits into from Oct 13, 2023
Merged

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Oct 10, 2023

This PR adds the sentryAstro Astro integration which will be the core component of the Astro SDK.

The integration takes care of a few things:

  • it injects SDK init code into the client and server entry points. This can happen in 3 different ways:
    • if the clientInitPath option is set, it will inject the file content from the specified file path
    • if a sentry.(client|server).config.(ts|js) file is found in the root dir, the file content will be injected
    • if neither of these cases apply, it will inject a default init call.
      • the default call can be customized with a few options that only add primitive values to the SDKs.
  • it registers the Sentry Vite plugin for source maps upload, if an auth token is provided.

The idea is: Basic SDK setup will only require sentryAstro to be added by users. Everything else happens automatically. We also support a more custom setup but it will require additional config files. The reason is that we can only inject serialized code. We cannot take e.g. function callbacks (e.g. beforeSend) in the options of sentryAstro.

For more details how to set up the SDK, feel free to take a look at the README.

UPDATE: To satisfy Astros soft requirement of making the integration the default integration of the package, I decided to actually transiple the integration with the rest of the code. Therefore, I removed the "integration sync" logic that was initially in this PR. To make this work, I slightly adjusted our NPM rollup config to opt out of adding polyfills. These caused problems in Astro and are not necessary (Astro is Node 18+, so no need for polyfills injected by Sucrase).

This also means that this integration will be correctly installed when running npx astro add @sentry/astro. So we basically get half a wizard for free 馃帀

ref #9182

@Lms24 Lms24 marked this pull request as ready for review October 10, 2023 20:34
@Lms24 Lms24 requested review from mydea, lforst and HazAT October 10, 2023 20:36
packages/astro/README.md Outdated Show resolved Hide resolved
packages/astro/README.md Outdated Show resolved Hide resolved
packages/astro/package.json Outdated Show resolved Hide resolved
@Lms24 Lms24 mentioned this pull request Oct 12, 2023
@Lms24 Lms24 self-assigned this Oct 12, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 12, 2023

size-limit report 馃摝

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 84.26 KB (0%)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.43 KB (0%)
@sentry/browser - Webpack (gzipped) 22.02 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 78.78 KB (-0.01% 馃斀)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.6 KB (-0.01% 馃斀)
@sentry/browser - ES6 CDN Bundle (gzipped) 21.02 KB (-0.01% 馃斀)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 254.48 KB (0%)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 86.76 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 62.45 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.48 KB (-0.01% 馃斀)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 84.29 KB (0%)
@sentry/react - Webpack (gzipped) 22.06 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 102.2 KB (0%)
@sentry/nextjs Client - Webpack (gzipped) 50.96 KB (0%)

@Lms24 Lms24 merged commit 1ba8d9f into develop Oct 13, 2023
84 checks passed
@Lms24 Lms24 deleted the lms/feat-astro-integration branch October 13, 2023 08:56
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.

None yet

2 participants