fix: prevent base64 bloat in Supabase generation tables - #39
Conversation
The qron-image-gen worker returns images as base64 data URIs (~294KB each). Storing these in guest_generations and qron_generations causes: - Supabase rows bloat to 300KB+ - Rate-limit queries timeout scanning massive rows - Subsequent guest generation requests 502 Fix: store a reference ID instead of the full base64 when the image is a data URI. The actual image is still returned to the client — only the database logging is changed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a4da354e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) | ||
|
|
||
| const qronId = crypto.randomUUID() | ||
| const storableImageUrl = imageUrl.startsWith('data:') ? `generated:${qronId}` : imageUrl |
There was a problem hiding this comment.
Preserve retrievable image URL in qron_generations
When the worker returns a data URI, this stores image_url as generated:${qronId}, but there is no code path that resolves generated:* back to an actual image URL, while /api/qron/[id] returns qron.image_url directly (app/api/qron/[id]/route.ts, GET response). That means QRONs generated through /api/generate lose a renderable/downloadable image reference once reloaded from the database, so downstream consumers of persisted records receive a non-URL placeholder instead of an image.
Useful? React with 👍 / 👎.
Summary
The
qron-image-genworker returns images as base64 data URIs (~294KB each). Storing these inguest_generationsandqron_generationscauses rows to bloat to 300KB+, rate-limit queries to timeout, and subsequent guest requests to 502.Fix
Store
generated:{uuid}reference instead of full base64 in database. Image still returned to client.Test plan
🤖 Generated with Claude Code