-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Sentry is not initialized on server-side for SSR Astro project #9463
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
Comments
Hi @aldy505 thanks for opening this issue ad I was able to reproduce this issue but only when the sentry-javascript/packages/astro/src/integration/index.ts Lines 64 to 70 in cb49f96
This probably only is executed one a pageload request comes in. I think, overall, this is not ideal so we should investigate if we can use another hook to initialize the SDK. However, given that Astro isn't primarily used as a general web service/API, I think initializing the SDK on the first page load request is somewhat acceptable. Related: I just merged #9445 which adds a Sentry middleware you can register in |
Oh furthermore, the reason why |
We have a similar problem since we upgraded to next 14. There is nothing special in either the sentry.client.config.ts or the sentry.server.config.ts (they are the same)
EDIT: It seems that the latest next canary version seems to fix it (14.0.2-canary.20) |
@Zellerich thanks for letting us know! If this turns out not to be fixed with the next canary version, please open a separate issue as our instrumentation for NextJS differs from the one in Astro. Thank you! |
I'm also seeing this in next.js on canary/latest and the latest sentry packages. |
Please open a new issue, this issue is related to Astro and has nothing to do with NextJS. Thank you. |
Hi, given that #9444 is complete and released with 7.82.0, as well as the fact that at the moment, we can't do a lot about initializing the server side earlier (i.e. before the first pageload request), I'm going to close this issue. Please let me know if it should be reopened. Thanks! |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/astro
SDK Version
7.77.0
Framework Version
3.4.2
Link to Sentry event
No response
SDK Setup
See repro below
Steps to Reproduce
See repro on https://github.com/aldy505/sentry-astro-endpoints-reproduction
Try for development build:
Run
npm run dev
, thencurl http://localhost:4321/sentry-endpoints/hello
. Check terminal/console, expect to see:Then try for production build:
Run
npm run build
, executeNODE_ENV=production node ./dist/server/entry.mjs
, thencurl http://localhost:4321/sentry-endpoints/hello
. Check terminal/console, expect to see:Expected Result
Sentry is initialized and event is sent.
Actual Result
The text was updated successfully, but these errors were encountered: