You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tRPC server errors not sent from vercel deployment. Local works fine #17024
Specifically, I have implemented Sentry.flush as I thought that was the most likely culprit, but to no avail.
Steps to Reproduce
Whenever I trigger an error in a tRPC endpoint on purpose, I get the error when working from local, but not when deployed on vercel. The full configuration can be seen here: studie-tech/TheNinjaRPG
I'm not using environment variables for the DSN, which seems to be a common cause of this. I've gone through the entire setup of Sentry again.
This worked a few months ago when initially set up, but has since then been broken.
Expected Result
Expect similar behavior on local and vercel deployment
Hello, most often this can be solved by flushing (as you already tried). I also see that you tried another flushing approach in the latest commit which was just 3 hours ago (this issue is 16h old now). Did that work for you now?
The reason for a need to flush is that the function may have a limited execution time and the error cannot be sent anymore. By awaiting a flush, the function executes a little longer.
The cause was that next build only picks up instrumentation.ts next to your app directory, so with src/app it must be in src/ (I see you already fixed that in your reprex).
Locally it worked because dev also finds it in the project root. The SDK will warn about this at build time soon (#25603). Closing, but feel free to reopen if something still doesn't show up.
Activity
linear commentedon Jul 15, 2025
JS-734 tRPC server errors not sent from vercel deployment. Local works fine
s1gr1d commentedon Jul 16, 2025
Hello, most often this can be solved by flushing (as you already tried). I also see that you tried another flushing approach in the latest commit which was just 3 hours ago (this issue is 16h old now). Did that work for you now?
The reason for a need to flush is that the function may have a limited execution time and the error cannot be sent anymore. By awaiting a flush, the function executes a little longer.
MathiasGruber commentedon Jul 17, 2025
Nope, as you mentioned I tried a few different flusing methods, but to no avail.
s1gr1d commentedon Jul 18, 2025
We're gonna have a look at this!
cc @chargome
18 remaining items
chargome commentedon Aug 8, 2025
No sorry what I meant was to use the Next.js after hook. Missed the import in my snippet:
import {after} from 'next/server'MathiasGruber commentedon Aug 10, 2025
Ah, okay, didn't know about that hook, I've updated:
studie-tech/TheNinjaRPG@9da2a0f
Result is the local still works, deployment on vercel does not.
chargome commentedon Aug 11, 2025
Thanks for confirming, this must be unrelated to flushing then which is strange. 🤔 We need to look into this in more detail.
s1gr1d commentedon Oct 21, 2026
The cause was that
next buildonly picks upinstrumentation.tsnext to yourappdirectory, so withsrc/appit must be insrc/(I see you already fixed that in your reprex).Locally it worked because dev also finds it in the project root. The SDK will warn about this at build time soon (#25603). Closing, but feel free to reopen if something still doesn't show up.