Open
Description
Bug report
- [ x] I confirm this is a bug with Supabase, not with my own application.
- [xx ] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
If any of the storage APIs returns a 400 error, the storage client doesn't properly handle the response and blows up trying to parse it as JSON.
To Reproduce
Do something that would return a 400 from the storage api (often happens with uploads when given incorrect parameters for example).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "supabase_storage_provider.py", line 39, in aclose
await (await self.provider.client).storage.from_(self.provider.bucket_name).upload(
File "venv/lib/python3.12/site-packages/storage3/_async/file_api.py", line 520, in upload
return await self._upload_or_update("POST", path, file, file_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/storage3/_async/file_api.py", line 493, in _upload_or_update
response = await self._request(
^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.12/site-packages/storage3/_async/file_api.py", line 54, in _request
raise StorageApiError(resp["message"], resp["error"], resp["statusCode"])
^^^^
NameError: name 'resp' is not defined
Expected behavior
expected result is an exception with a description of the problem, not blowing up on parsing JSON
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. chrome, safari]
- Version of supabase-js: [e.g. 6.0.2]
- Version of Node.js: [e.g. 10.10.0]
Additional context
Add any other context about the problem here.