Repository navigation
Fix social card images returning a 500 - #4880
Merged
Merged
Conversation
The social card API routes ran on the Edge runtime, where Next bundles the configured cacheHandler into every edge function. cache-handler.mjs pulls in redis and @fortedigital/nextjs-cache-handler, which need Node built-ins such as node:assert/strict, so the routes failed while loading and every request returned a 500. Run the routes on the default Node.js runtime, read the fonts and the illustration from disk rather than fetching them from the site's own origin, and share the image response code between the four routes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yeTaRwbVxnHtah3pLH4K4
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Moves the four social card API routes from the Edge runtime to Node. They now read fonts and the illustration from Minor points:
|
This branch had an error being 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.
What
The social card images (
/api/en/social-cardand the news, keynote and event variants) returned a 500 on every request. This moves the four routes from the Edge runtime to the default Node.js runtime, which makes them render again.Why
Next bundles the configured
cacheHandlerinto every Edge function.cache-handler.mjsimportsredisand@fortedigital/nextjs-cache-handler, which need Node built-ins, so the routes crashed while loading:Next 16 also deprecates the Edge runtime and asks for the
runtimeexport to be removed.Changes
runtime: "edge"from the four social card routes and switch the handlers toNextApiRequest/NextApiResponse.public/on disk instead of fetching them over HTTP from the site's own origin.sendSocialCard(frontend/src/helpers/social-card.tsx).Testing
Run locally against a mock GraphQL backend built from
backend/schema.graphql:/api/en/social-cardreturns the 500 above innext devand in a production standalone build.next devand in a production standalone build with the Redis cache handler connected./api/it/social-cardrenders the Italian month name.@vercel/ogwasm and font files plus the three assets read frompublic/.ToDo
Generated by Claude Code