Storage PUT returning an error
See original GitHub issueBug report
Describe the bug
The PUT method used for updating storage files is failing with a cryptic error:
node[9379]: ../src/node_http_parser.cc:567:static void node::{anonymous}::Parser::Initialize(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[3]->IsInt32()' failed.
1: 0xb200e0 node::Abort() [node]
2: 0xb2015e [node]
3: 0xb377b2 [node]
4: 0xd6fc5b [node]
5: 0xd7110c [node]
6: 0xd71786 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
7: 0x1640939 [node]
Aborted
To Reproduce
const arrayBuffer = new ArrayBuffer(8);
let buffer = Buffer.from(arrayBuffer);
fetch(
`${SUPABASE_URL}/storage/v1/object/${projectRef}/avatars/${name}`,
{
method: 'PUT',
mode: 'cors',
cache: 'no-cache',
headers: {
Accept: '*/*',
Authorization: `Bearer ${SUPABASE_SERVICE}`,
},
body: buffer,
},
)
.then((res) => res.json())
.then((res) => {
console.log(res);
});
The above code works perfectly with the POST
method so I assume it’s not something wrong with my code? Swagger mentions needing a project’s projectRef
, I assume that’s the random string I can find in my url when viewing a project on Supabase?
Expected behavior
My file should be updated.
System information
- OS: Linux
- Version of supabase-js: N/A
- Version of Node.js: 16.4.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Storage.put() returns success when offline #9703 - GitHub
Expected behavior. If the API is unable to successfully upload the file it should throw an error or call the error callback. Reproduction...
Read more >Laravel storage put returns "The image failed to upload."
I am unsure whether the error occurs when uploading or when moving the uploaded file to storage. Could you place a dd($request->file('image')) ...
Read more >Storage - Cancel requests - JavaScript - AWS Amplify Docs
You may cancel any put , get , or copy requests made by the Storage API by keeping a reference to the promise...
Read more >HTTP status and error codes for JSON | Cloud Storage
Cloud Storage uses the standard HTTP error reporting format for the JSON API. Successful requests return HTTP status codes in the 2xx range....
Read more >Error Responses - Amazon Simple Storage Service
Error Code Description HTTP Status Code
AccessControlListNotSupported The bucket does not allow ACLs. 400 Bad Request
AccessDenied Access Denied 403 Forbidden
BucketAlreadyOwnedByYou 409 Conflict (in all...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh not sure…We didn’t update the storage version in prod in the last 2 weeks, but glad to know it is fixed! Will close the issue for now then.
Wow that does look like a scary error.
Does your Node script which is making the request crashing? That is weird
I will look into this closer tomorrow @creativiii but for now can you try sending the
Content-Type
andContent-Length
header?