-
-
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
errors in remix loaders/actions on vercel aren't reported #13825
Comments
Hi @boertel thanks for writing in and for providing a repro! I checked your setup and everything was working as expected using a production build:
If you are facing issues with capturing errors on vercel I would argue with this setup this is most likely due to misconfiguration of env vars – you could set |
Would you have any feedback/inputs on how I can debug this? I'm still not seeing any server issues getting to sentry when deployed to vercel. I added a few console.log (and tried a lot of different things :D see commits in my repo) to see what was set up on vercel, using
|
@boertel did you add |
Do you have any special network configuration or a proxy running? |
nothing special, it is using bare bone vercel. I did some more testing/investigation yesterday, and I was able to report some issues to sentry, and here are the steps to do so:
I checked my |
It's very much possible that the events are not flushed because the AWS lambdas on Vercel are freezing on response end and the SDK didn't yet get the chance to flush out the data. Can you look at this post from Vercel which introduces a new API for exactly that, and try to do |
genius ! Here is my export function handleError(error: Error, { request }: { request: Request }) {
Sentry.captureRemixServerException(error, "remix.server", request, true);
waitUntil(Sentry.flush());
} and I am seeing all server errors being reported now 🎉 Thank you so much, after spending so much time investigating I was scared that it was a misconfiguration on my side but it wasn't 😄 |
Glad that you could figure it out! To be fair, we should add docs around this. |
I'm also surprised that nobody had this issue before, it doesn't seem to be something new. Maybe I'm over estimating the number of people hosting remix on vercel, and adding sentry! I started fresh by running:
The 2 changes that I needed to do in order to get server errors reported on sentry were to have this in my import * as Sentry from "@sentry/sentry";
import { waitUntil } from "@vercel/functions";
// initializing sentry here instead of NODE_OPTIONS='--import ./instrumentation.server.mjs'
Sentry.init({
dsn: process.env.VITE_SENTRY_DSN,
tracesSampleRate: 1,
autoInstrumentRemix: true,
});
export const handleError = Sentry.wrapHandleErrorWithSentry(
(error, { request }) => {
// adding this line
waitUntil(Sentry.flush());
}
); vercel doesn't have a "npm start" so I'm not sure how we could "plug in" I'm closing the issue now, and thanks again for your help, much appreciated! |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/remix
SDK Version
8.31.0
Framework Version
[email protected]
Link to Sentry event
No response
Reproduction Example/SDK Setup
https://github.com/boertel/sentry-action-error/
a few tests that I did:
npm run build
andnpm run start
) and the errors are reportedcaptureException
which doesn't workSteps to Reproduce
VITE_SENTRY_DSN
as an environment variable2 access the page /sentry-example-page
Expected Result
Expected behavior is to see: "Sentry Error" on my Sentry Issues
(I do see a
Unexpected Server Error
but it is reported by https://github.com/boertel/sentry-action-error/blob/main/app/root.tsx#40 on the client side)Actual Result
error is not showing in my Issues
The text was updated successfully, but these errors were encountered: