Repository navigation
fix(api): bound /api/grade on slow or failing Gemini calls - #36
Merged
Merged
Conversation
Vercel picked npm because both lockfiles were committed, while CI installs with bun --frozen-lockfile. Builds logged ERESOLVE peer warnings for typescript and could drift from what CI tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Give generateObject a 60s deadline and answer 504 GradingTimeout, so a stuck call no longer holds the function for up to 300s (one took 235s). - Answer gateway 5xx with 503 GradingUnavailable instead of 500: the SDK never retries GatewayError, so an outage hit users on the first attempt. - Route pdf.js "Warning: ..." lines from console.log to console.warn so they land as WARN in Dash0 instead of INFO. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes found in 7 days of
open-silverlogs in Dash0: a/api/gradecall that ran 235s, a Gemini gateway 503 reported as our own 500, pdf.js warnings logged as INFO, and Vercel installing with npm.APICallError, andGatewayErrorisn't one. So a gateway 503 failed on the first attempt.GatewayResponseErrorwith status 500. That's why the timeout check runs before the gateway-5xx check.package-lock.jsonis deleted, so Vercel builds with bun the same way CI does.@ai-sdk/gatewayis now a direct dependency so the route can checkGatewayError.isInstance.Evidence
POST /api/gradetook 235s, 96s and 61s on its slowest calls. On Oct 3 20:33 aGatewayInternalServerError(503) was returned to the user as500 GradingError.Warning: TT: undefined functionwas logged about 100 times at INFO. Vercel build logs shownpm warn ERESOLVEfor typescript.After (local dev server):
bun run test), plusbun tscand lint.Merge Danger
Door: two-way
Revert the commits to undo everything. Restoring
package-lock.jsonon its own would put Vercel back on npm.Blast Radius: resume-checker
console.logis patched for the whole process. Only lines starting withWarning:are redirected.🤖 Generated with Claude Code