python - Supabase unable to find the bucket, even though its present - Stack Overflow

admin2025-04-16  4

Stacktrace:

File "C:\Users\kanwa\AppData\Roaming\Python\Python313\site-packages\storage3_sync\file_api.py", line 51, in _request raise StorageException({**resp, "statusCode": response.status_code}) storage3.utils.StorageException: {'statusCode': 400, 'error': 'Bucket not found', 'message': 'Bucket not found'}

I get the error above running this script:

def upload_resume_to_applicant_record(resume_file, opening_id, applicant_mobile_number):

    supabase.storage.from_('applicant-resumes').upload(
            file=resume_file.read(),
            path=f"{opening_id}/{applicant_mobile_number}",
            file_options={"cache-control": "3600", "upsert": "false"},
        )

The bucket I have created, "applicant-resumes" is a public bucket, with "INSERT" policies to allow insertion by anyone.

I want to send files from the backend to the bucket for storage, I have looked up the docs for Python and Supabase and haven't found any relevant answer, I have set up the SUPABSAE_URL AND SUPABSAE_KEYS and can perform other actions such as reading from the tables.

Please let me know how can I fix the error here and send the files to my database from the python script.

Stacktrace:

File "C:\Users\kanwa\AppData\Roaming\Python\Python313\site-packages\storage3_sync\file_api.py", line 51, in _request raise StorageException({**resp, "statusCode": response.status_code}) storage3.utils.StorageException: {'statusCode': 400, 'error': 'Bucket not found', 'message': 'Bucket not found'}

I get the error above running this script:

def upload_resume_to_applicant_record(resume_file, opening_id, applicant_mobile_number):

    supabase.storage.from_('applicant-resumes').upload(
            file=resume_file.read(),
            path=f"{opening_id}/{applicant_mobile_number}",
            file_options={"cache-control": "3600", "upsert": "false"},
        )

The bucket I have created, "applicant-resumes" is a public bucket, with "INSERT" policies to allow insertion by anyone.

I want to send files from the backend to the bucket for storage, I have looked up the docs for Python and Supabase and haven't found any relevant answer, I have set up the SUPABSAE_URL AND SUPABSAE_KEYS and can perform other actions such as reading from the tables.

Please let me know how can I fix the error here and send the files to my database from the python script.

Share Improve this question edited Feb 4 at 4:20 K J P Singh asked Feb 4 at 2:59 K J P SinghK J P Singh 317 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

This usually occurs due to access permissions. You can look into https://supabase.com/docs/guides/platform/permissions to check on permissions.

转载请注明原文地址:http://anycun.com/QandA/1744741593a86962.html