Trouble with File Upload in Self-Hosted Supabase Using Docker
Problem
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 I'm currently facing a perplexing problem while attempting to manually upload files to the Supabase bucket on my self-hosted instance using Docker. The issue arises when I initiate the upload process – the progress gets stuck at 0% and the upload never seems to commence. I've conducted this experiment on multiple computers and have tried various file types, yet regrettably, none of these attempts have proved successful. To Reproduce 1. Set up self-hosted Supabase instance using Docker. 2. Open the dashboard and head to bucket 3. Upload one/multiple files Expected behavior The manual file upload process should initiate normally, progressing from 0% to completion, allowing the files to be uploaded successfully to the Supabase bucket. Screenshots System information - OS: Rocky Linux 9 - Browser: Microsoft Edge, Chrome - Version of supabase-js: latest - Version of Node.js: 20.5.1 Additional context - I have ensured that I haven't made any erroneous configurations in my settings, but I'm open to the possibility that I might have missed something crucial. - Interestingly, upon executing the command "docker ps -a," I can confirm that the storage function is indeed running, which adds a layer of complexity to diagnosing the issue. [code block] - It's worth mentioning that I've also port forwarded the
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix File Upload Stuck at 0% in Self-Hosted Supabase
The issue is likely caused by misconfigured CORS settings or incorrect bucket permissions in the Supabase storage service, preventing the upload process from initiating correctly. Additionally, if the storage service is not properly linked to the API or if the Docker network settings are incorrect, it can lead to upload failures.
Awaiting Verification
Be the first to verify this fix
- 1
Check CORS Configuration
Ensure that the CORS settings in your Supabase storage configuration allow requests from your frontend application. This can be done by modifying the CORS settings in the Supabase dashboard or directly in the configuration file.
bashcurl -X POST 'http://<your-supabase-url>/storage/v1/cors' -H 'Authorization: Bearer <your-api-key>' -d '{"allowed_origins": ["*"], "allowed_methods": ["GET", "POST", "PUT", "DELETE"], "allowed_headers": ["*"], "exposed_headers": [], "max_age": 3600}' - 2
Verify Bucket Permissions
Check the permissions of the bucket you are trying to upload files to. Ensure that the bucket has the correct policies set to allow uploads for the authenticated user or public access if required.
sqlSELECT * FROM storage.buckets WHERE name = '<your-bucket-name>'; - 3
Inspect Docker Network Settings
Ensure that your Docker containers are correctly networked. Check if the Supabase API and storage services are on the same Docker network. You can inspect the network settings using 'docker network ls' and 'docker inspect <network-name>'.
bashdocker network inspect <network-name> - 4
Restart Supabase Services
Sometimes, simply restarting the Supabase services can resolve issues. Use Docker commands to restart the containers and ensure they are running correctly.
bashdocker-compose down && docker-compose up -d - 5
Check Logs for Errors
Review the logs for the Supabase storage service to identify any errors that may indicate what is causing the upload to fail. Use the command below to view the logs.
bashdocker logs <storage-container-name>
Validation
To confirm the fix worked, attempt to upload a file again through the Supabase dashboard. The upload progress should move past 0% and complete successfully. Additionally, check the browser console for any CORS-related errors or network issues.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep