Skip to content

S3 presign do not work in local edge #637

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

Open
2 tasks done
riderx opened this issue Mar 3, 2025 · 3 comments
Open
2 tasks done

S3 presign do not work in local edge #637

riderx opened this issue Mar 3, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@riderx
Copy link

riderx commented Mar 3, 2025

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • 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 riderx added the bug Something isn't working label Mar 3, 2025
@riderx
Copy link
Author

riderx commented Mar 3, 2025

@riderx
Copy link
Author

riderx commented Mar 3, 2025

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

@riderx
Copy link
Author

riderx commented Mar 3, 2025

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'
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant