Skip to content

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

@mdradhi

Description

@mdradhi

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • 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:
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions