Skip to content

fix: handling of supabase error responses when creating a signed url#2218

Merged
DonKoko merged 4 commits intomainfrom
fix-supabase-storage-html-error-when-refreshing-images
Nov 27, 2025
Merged

fix: handling of supabase error responses when creating a signed url#2218
DonKoko merged 4 commits intomainfrom
fix-supabase-storage-html-error-when-refreshing-images

Conversation

@DonKoko
Copy link
Copy Markdown
Contributor

@DonKoko DonKoko commented Nov 27, 2025

  • add a retry-and-log guard in createSignedUrl for Supabase HTML/StorageUnknownError responses, with inline docs and helpers at file end
  • normalize signed URL error metadata to safe strings to satisfy TS
  • covers all callers (asset/kit refresh) via the shared helper

@DonKoko DonKoko requested a review from Copilot November 27, 2025 09:45
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 27, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
shelf-docs Ignored Ignored Preview Nov 27, 2025 10:29am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the robustness of signed URL creation by adding retry logic to handle transient Supabase errors. When Supabase occasionally returns HTML error pages (e.g., CDN/edge 50x errors) that get surfaced as StorageUnknownError, the code now retries once before failing, preventing transient issues from bubbling up as user-facing errors.

Key changes:

  • Added retry-and-log guard with up to 2 attempts for handling Supabase HTML/StorageUnknownError responses
  • Normalized error metadata (errorName, errorMessage) to safe strings for TypeScript compatibility
  • Added helper functions isSupabaseHtmlError and wait at the file end

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread app/utils/storage.server.ts Outdated
Comment thread app/utils/storage.server.ts
Comment thread app/utils/storage.server.ts Outdated
Comment thread app/utils/storage.server.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread app/utils/storage.server.ts Outdated
Comment thread app/utils/storage.server.ts Outdated
@DonKoko DonKoko merged commit f1cb6a4 into main Nov 27, 2025
7 checks passed
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