Skip to content

fix: prevent base64 bloat in Supabase generation tables - #39

Merged
undone0603 merged 1 commit into
mainfrom
claude/fix-guest-gen-base64-bloat
Apr 12, 2026
Merged

fix: prevent base64 bloat in Supabase generation tables#39
undone0603 merged 1 commit into
mainfrom
claude/fix-guest-gen-base64-bloat

Conversation

@undone0603

Copy link
Copy Markdown
Collaborator

Summary

The qron-image-gen worker returns images as base64 data URIs (~294KB each). Storing these in guest_generations and qron_generations causes 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

  • Guest generation returns 200 with image
  • Database rows stay small
  • Rate limiting works (429 not 502)

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
qron-app Ready Ready Preview, Comment Apr 11, 2026 8:31pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread app/api/generate/route.ts
)

const qronId = crypto.randomUUID()
const storableImageUrl = imageUrl.startsWith('data:') ? `generated:${qronId}` : imageUrl

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@undone0603
undone0603 merged commit d19dc8e into main Apr 12, 2026
4 checks passed
@undone0603
undone0603 deleted the claude/fix-guest-gen-base64-bloat branch April 12, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants