storage icon indicating copy to clipboard operation
storage copied to clipboard

Storage API Error: "relation 'objects' does not exist" - Service Cannot Access storage.objects Table

Open mdradhi opened this issue 3 months ago • 2 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

The Storage API returns a 500 error with message relation "objects" does not exist when attempting to upload files, even though the storage.objects table exists and is accessible via direct SQL queries. This appears to be a Storage API service configuration issue where the service cannot access the storage schema.

Project Ref: xuopmhatztqhekepnxic Request ID: 0199c13f-4f3a-7bbc-9861-201565b26709 Timestamp: 2025-10-08T00:36:16Z

## To Reproduce

Steps to reproduce the behavior:

  1. Create a private storage bucket named source-of-documents
  2. Configure RLS policies on storage.objects for tenant isolation
  3. Attempt to upload a file using either:
  • Supabase JS client: supabase.storage.from('source-of-documents').upload(path, file)
  • Direct curl: curl -X PUT https://xuopmhatztqhekepnxic.supabase.co/storage/v1/object/source-of-documents/5t6e8550-f4rt-41d4-a2123-43gf55441000%2Ftest.txt -H "Authorization: Bearer [JWT]" --data-binary @file.txt
  1. Observe 500 error

Error Response:

{
  "statusCode": "500",
  "code": "DatabaseError",
  "error": "DatabaseError",
  "message": "insert into \"objects\" (\"bucket_id\", \"metadata\", \"name\", \"owner\", \"owner_id\", \"user_metadata\", \"version\") values ($1, DEFAULT, $2, $3, $4, DEFAULT, $5) on conflict (\"name\", \"bucket_id\") do update set \"version\" = $6,\"owner\" = $7,\"owner_id\" = $8 returning * - relation \"objects\" does not exist"
}

What I've verified:

storage.objects table exists (confirmed via SELECT * FROM pg_tables WHERE schemaname = 'storage' AND tablename = 'objects') ✅ Direct SQL INSERT works: INSERT INTO storage.objects (bucket_id, name, owner, metadata) VALUES (...) ✅ Permissions granted to authenticator role ✅ Bucket exists and is properly configured ✅ RLS policies are configured

## Expected behavior

File upload should succeed and return a 200/201 response with the uploaded file metadata.

## Screenshots

Error in browser console:

POST https://xuopmhatztqhekepnxic.supabase.co/storage/v1/object/source-of-documents/... 500 (Internal Server Error)

Upload error: {
  statusCode: '500', 
  code: 'DatabaseError', 
  error: 'DatabaseError', 
  message: 'insert into "objects" ... - relation "objects" does not exist'
}

## System information

  • OS: Windows
  • Browser: Chrome (latest)
  • Version of supabase-js: 2.x (using @supabase/supabase-js)
  • Version of Node.js: 20.x
  • Database: PostgreSQL 17.4

## Additional context

Timeline of failed attempts:

  • 2025-10-08T00:36:16Z (curl with user JWT)
  • 2025-10-07T19:52:00Z (browser upload)
  • 2025-10-07T19:51:41Z (browser upload)
  • 2025-10-07T19:44:19Z (browser upload)

Diagnosis: The Storage API service cannot access storage.objects even though the table exists. This suggests:

  1. Storage service has incorrect database connection configuration
  2. Storage service search_path doesn't include storage schema
  3. Storage service is connecting to wrong database

What works:

  • Direct SQL queries to storage.objects work perfectly
  • Table ownership and permissions are correct
  • Bucket and RLS policies are properly configured

Impact: This is blocking all file uploads in the application. The issue persists even after:

  • Restarting the Supabase project
  • Resetting role configurations
  • Granting explicit permissions to all relevant roles

Please investigate the Storage API service configuration for project xuopmhatztqhekepnxic.

mdradhi avatar Oct 08 '25 07:10 mdradhi

Hi team 👋,

Do we have any updates regarding the Storage API error with the storage.objects table? The service is still returning "relation 'objects' does not exist" when attempting to upload files, even though the table is present and accessible via direct SQL queries.

Any insights or progress would be greatly appreciated.

Thanks in advance.

leomerida15 avatar Oct 23 '25 12:10 leomerida15

@fenos - Transferred from the supabase/supabase repo.

Hallidayo avatar Nov 15 '25 20:11 Hallidayo