question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storage PUT returning an error

See original GitHub issue

Bug 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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
iniancommented, Jul 15, 2021

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.

1reaction
iniancommented, Jul 1, 2021

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 and Content-Length header?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found