-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(solidstart): Add withSentry
config wrapper
#13784
Conversation
5e1af7a
to
cc78ede
Compare
I'm investigating my claim in the note to reviewers. I might be wrong here and we can simplify to just using |
packages/solidstart/README.md
Outdated
If your `instrument.server.ts` file is not located in the `src` folder, you can specify the path via the | ||
`sentrySolidStartVite` plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: The option is instrumentation
right? You could add this here, so it is clear where the path can be specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I updated the readme to make this clearer.
packages/solidstart/README.md
Outdated
Sentry relies on running `instrument.server.ts` as early as possible. Add the `sentrySolidStartVite` plugin from | ||
`@sentry/solidstart` to your `app.config.ts`. This takes care of building `instrument.server.ts` and placing it | ||
alongside the server entry file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L: I would restructure this a little bit at it is hard to follow when reading it first. The first sentence says it relies on running the file as early as possible but the explanation for this comes later.
The proposed structure: do this -> why to do this -> what it does.
Sentry relies on running `instrument.server.ts` as early as possible. Add the `sentrySolidStartVite` plugin from | |
`@sentry/solidstart` to your `app.config.ts`. This takes care of building `instrument.server.ts` and placing it | |
alongside the server entry file. | |
Add the `sentrySolidStartVite` plugin from `@sentry/solidstart` to your plugins in `app.config.ts`. Sentry relies on running `instrument.server.ts` as early as possible. The `sentrySolidStartVite` plugin builds the `instrument.server.ts` file and places it alongside the server entry file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I updated the readme and removed some of this explanation in favor of simplicity. Maybe this is better kept in the docs.
packages/solidstart/README.md
Outdated
|
||
To upload source maps, configure an auth token. Auth tokens can be passed to the plugin explicitly with the `authToken` | ||
option, with a `SENTRY_AUTH_TOKEN` environment variable, or with an `.env.sentry-build-plugin` file in the working | ||
directory when building your project. We recommend you add the auth token to your CI/CD environment as an environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
directory when building your project. We recommend you add the auth token to your CI/CD environment as an environment | |
directory when building your project. We recommend adding the auth token to your CI/CD environment as an environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated.
…instrumentation files
cc78ede
to
084f7f1
Compare
084f7f1
to
82e4c12
Compare
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky tests
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
Closing this for now as it needs to be reworked, using dynamic import instead of top-level-import of the instrumentation file to get around deploy platform restrictions of not being able to |
…verSentry` (#14862) This PR adds a `withSentry` wrapper for SolidStart's config to build and place `instrument.server.ts` alongside the server build output so that it doesn't have to be placed in `/public` anymore to be discoverable. The setup is changed to be aligned with Nuxt. First, the `instrument.server.ts` file is added to the build output (the sentry release injection file needs to be copied as well - this is not ideal at the moment as there **could** be other imports as well, but it's okay for now) Then, there are two options to set up the SDK: 1. Users provide an `--import` CLI flag to their start command like this: ```node --import ./.output/server/instrument.server.mjs .output/server/index.mjs``` 2. Users can add `autoInjectServerSentry: 'top-level-import'` and the Sentry config will be imported at the top of the server entry ```typescript // app.config.ts import { defineConfig } from '@solidjs/start/config'; import { withSentry } from '@sentry/solidstart'; export default defineConfig(withSentry( { /* ... */ }, { autoInjectServerSentry: 'top-level-import' // optional }) ); ``` --- builds on top of the idea in this PR: #13784 --------- Co-authored-by: Andrei Borza <[email protected]>
…erSentry` (#14862) This PR adds a `withSentry` wrapper for SolidStart's config to build and place `instrument.server.ts` alongside the server build output so that it doesn't have to be placed in `/public` anymore to be discoverable. The setup is changed to be aligned with Nuxt. First, the `instrument.server.ts` file is added to the build output (the sentry release injection file needs to be copied as well - this is not ideal at the moment as there **could** be other imports as well, but it's okay for now) Then, there are two options to set up the SDK: 1. Users provide an `--import` CLI flag to their start command like this: ```node --import ./.output/server/instrument.server.mjs .output/server/index.mjs``` 2. Users can add `autoInjectServerSentry: 'top-level-import'` and the Sentry config will be imported at the top of the server entry ```typescript // app.config.ts import { defineConfig } from '@solidjs/start/config'; import { withSentry } from '@sentry/solidstart'; export default defineConfig(withSentry( { /* ... */ }, { autoInjectServerSentry: 'top-level-import' // optional }) ); ``` --- builds on top of the idea in this PR: #13784 --------- Co-authored-by: Andrei Borza <[email protected]>
…erSentry` (#14862) This PR adds a `withSentry` wrapper for SolidStart's config to build and place `instrument.server.ts` alongside the server build output so that it doesn't have to be placed in `/public` anymore to be discoverable. The setup is changed to be aligned with Nuxt. First, the `instrument.server.ts` file is added to the build output (the sentry release injection file needs to be copied as well - this is not ideal at the moment as there **could** be other imports as well, but it's okay for now) Then, there are two options to set up the SDK: 1. Users provide an `--import` CLI flag to their start command like this: ```node --import ./.output/server/instrument.server.mjs .output/server/index.mjs``` 2. Users can add `autoInjectServerSentry: 'top-level-import'` and the Sentry config will be imported at the top of the server entry ```typescript // app.config.ts import { defineConfig } from '@solidjs/start/config'; import { withSentry } from '@sentry/solidstart'; export default defineConfig(withSentry( { /* ... */ }, { autoInjectServerSentry: 'top-level-import' // optional }) ); ``` --- builds on top of the idea in this PR: #13784 --------- Co-authored-by: Andrei Borza <[email protected]>
This PR adds a
withSentry
wrapper for SolidStart's config to build and placeinstrument.server.ts
alongside the server build output so that it doesn't have to be placed in/public
anymore to be discoverable.It also adds an experimental option to top level import
instrument.server.ts
in the server entry file for platforms that currently do not support--import
, overriding the start command or setting scopedNODE_OPTIONS
(e.g. Vercel, Netlify (free version)).The configuration now looks like this:
Note to reviewers
Unfortunately, we need bothwithSentry
andsentrySolidStartVite
because SolidStart's config allows thevite
configuration to be a function that gets the current build target (i.e.server
,client
,server-fns
) passed in and we cannot add our plugin first for this case as the function would have to be executed (and thus run all predefined plugins) before we can add our plugin.The
sentrySolidStartVite
plugin is now automatically added bywithSentry
.Closes: #13785