-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storage download failing due to JSON decode #721
Comments
We are seeing a 403 error thrown. Seems transient as making the same request again will work. |
Example request: (removed some values for security purposes) HTTP Request: GET https://[BASE SUPABASE URL]/storage/v1/object/[BUCKET]/[FOLDER]/[FILE] "HTTP/1.1 403 Forbidden" |
Hey @ddematheu, thanks for the report
Is there a possibility of a race-condition where the user is not yet logged in when making a request? If you log (before) each request can you see that the headers include the authorization code? (Did you make any changes to your own application before 1030 PT? We haven't made any changes this weekend, and we aren't seeing this across other customers) |
Hey @ddematheu, Thanks for the query - we've are looking into the issue. It looks like we might need to update the error handling If possible, can I trouble you for the code surrounding the section where the Let us know! |
Saw the fix that was introduced for 0.7.1. It contains another bug: NameError: name 'JSONDecodeError' is not defined The bucket in questions has an RLS policy to allow only authenticated users and our anon key access. That said we are using our service role key to access the files from our backend. happy to provide more details for repro, but would prefer to do it via email if that is okay. [email protected] |
@ddematheu please check 0.7.3 which should fix the |
Hey @ddematheu, Apologies I think an import was missed which @silentworks has patched 🙏 Will send over an email from support channel in a bit |
Bug report
Describe the bug
download
method is throwing an exception when downloading a file.To Reproduce
Initialize supabase client and attempt to download a file using method:
Throws Error: Expecting value: line 1 column 1 (char 0)
Trace:
Traceback (most recent call last):
File "/app/supabase_utils/download_utils.py", line 39, in download_with_retry
response = supabase.storage.from_(bucket_name).download(file_path)
File "/usr/local/lib/python3.10/site-packages/storage3/_sync/file_api.py", line 339, in download
response = self._request(
File "/usr/local/lib/python3.10/site-packages/storage3/_sync/file_api.py", line 49, in _request
{**response.json(), "statusCode": response.status_code}
File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 761, in json
return jsonlib.loads(self.content, **kwargs)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Expected behavior
File is downloaded if its available or 400 is returned if the file is not available.
System information
Additional context
Add any other context about the problem here.
Seeing error across version 2.3.6-2.4.0
The text was updated successfully, but these errors were encountered: