Repository navigation
fix(storage): exists reports invalid JWT or missing bucket as missing file - #2783
Conversation
…ng file Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
🔍 Description
What changed?
StorageFileApi.exists()now reads the object info (GET /object/info/...) instead of sending aHEADrequest.{ data: true, error: null }when the object is found.{ data: false, error }only forNoSuchKey, or a 404 with no error code.InvalidJWT,NoSuchBucket, other 4xx/5xx, and network errors.throwOnError(), a missing object throws as before.existsdescribe these cases, and unit tests cover each one.Why was this change needed?
A
HEADresponse has no body, so the client could not tell an invalid or expired JWT (400) or a missing bucket (404) from a missing object.exists()treated every 400 and 404 as "file does not exist" and returnedfalse.This is consistent with changes made in Swift and Flutter: https://linear.app/supabase/issue/SDK-2286/drift-storagefile-bucketsfile-exists-js
🔄 Breaking changes
exists()previously returnedfalsefor any 400. It now throws for a 400 that is not a missing key, such asInvalidJWT. Callers that relied onfalsefor those cases now get the real error.📋 Checklist
<type>(<scope>): <description>pnpm nx formatto ensure consistent code formatting🤖 Generated with Claude Code