storage icon indicating copy to clipboard operation
storage copied to clipboard

S3 presign do not work in local edge

Open riderx opened this issue 10 months ago • 3 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

using AWS SDK and Supabase presign won't work in local test:

bun run test:supabase-s3                                                               1 ✘  12:08:48 
$ bun test test/supabase_s3.test.ts
bun test v1.2.2 (c1708ea6)

test/supabase_s3.test.ts:
error: Unable to connect. Is the computer able to access the url?
  path: "http://kong:8000/storage/v1/object/upload/sign/uploads/test-1741004174306.txt?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJ1cGxvYWRzL3Rlc3QtMTc0MTAwNDE3NDMwNi50eHQiLCJ1cHNlcnQiOmZhbHNlLCJpYXQiOjE3NDEwMDQxNzUsImV4cCI6MTc0MTAwNDIzNX0.oSVT-Rjl5mxFnMdrBy0GzD0-Q1m2vUr10Fh6PYwZIRo",
 errno: 0,
  code: "ConnectionRefused"

✗ Storage Upload > should generate signed URL and upload file [1320.29ms]

 0 pass
 1 fail
 5 expect() calls
Ran 1 tests across 1 files. [1483.00ms]
error: script "test:supabase-s3" exited with code 1

And for AWS one:


To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

https://github.com/riderx/supabase_edge_issue/tree/test_s3

Expected behavior

AWS and supabase presign should work in egde local

riderx avatar Mar 03 '25 12:03 riderx

also found here issue with AWS https://www.reddit.com/r/Supabase/comments/1hrmkf0/uploading_to_aws_s3_through_edge_function_not/

riderx avatar Mar 03 '25 17:03 riderx

i made 3 kind of test, supabase SDK, aws sdk, and @bradenmacdonald/s3-lite-client

riderx avatar Mar 03 '25 18:03 riderx

Managed to make it work on each: for supabase SDK it needs to do: signedUrl.replace('http://kong:8000', 'http://localhost:54321')

For @bradenmacdonald/s3-lite-client it need to add optional headers:

{
      parameters: {
        'X-Amz-Content-Sha256': 'UNSIGNED-PAYLOAD',
        'x-amz-checksum-crc32': 'AAAAAA==',
        'x-amz-sdk-checksum-algorithm': 'CRC32',
        'x-id': 'PutObject'
      }
}

riderx avatar Mar 03 '25 18:03 riderx

It's a problem again now

riderx avatar Sep 25 '25 00:09 riderx

Hey just coming back to this issue. I think we can close this right @riderx? I noticed that #771 fixed the issue

awaseem avatar Oct 31 '25 00:10 awaseem

Yes thanks guys

riderx avatar Oct 31 '25 09:10 riderx