-
Notifications
You must be signed in to change notification settings - Fork 136
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
SELECT fails on pre-signed URLs due to CORS errors in DuckDB-Wasm #1852
Comments
Using curl, in native:
So I would interpret that as the HEAD request not being valid at all, it's not a CORS problem but a problem with presigned URLs that I think do allow only GET methods (I think, unsure, this one for sure). I would need to check this in the shell, sounds possible an error should be dealt with better and recover from it |
I'm having the same issue with R2. I think it might be related to the presigned URL only being valid for whatever method you've specified to access the data. In duckdb wasm when we read or attach to a file in most cases a HEAD and then a GET request are sent. There's a few other issues talking about this #699. Curious if there's any solution? Sounds like a possible work around is to create a modified version which sends a ranged GET request first instead of the HEAD request. At which point only GET requests would be sent. |
Maybe check the following: https://stackoverflow.com/a/76836943 Also, can you access the presigned URL via curl w/o Problem? |
@tobilg can't curl mine either... sorry if URL expires.
Maybe I need to get rid of special characters in my bucket and .duckdb in my object. |
Have you checked adding the |
Thank you for your confirmation. I added the following setting to CORS:
but it still results in an error at the time of the HEAD request. |
this is huge! |
@coji I tried out this example app from @e1arikawa using your above example but still cannot get it to work. So maybe it is a CORS issue, or this app is incomplete for testing this, or the PR doesn't work for our desired use case? Either way maybe give it a try too and see if you can query your S3 parquet file. I still see
|
What happens?
When executing a SELECT statement in DuckDB-Wasm on a data source accessed via a pre-signed URL (especially those created for GET requests), the operation fails due to CORS errors. This prevents querying data stored in locations that require pre-signed URLs for access.
To Reproduce
Example SQL query:
Note: I tried this query on shell.duckdb.org, and it failed to access the data.
Additional context:
The current behavior seems to be:
xhr.send(null)
, which is not caught.This behavior was observed both in a local DuckDB-Wasm implementation and on shell.duckdb.org.
Importantly, the bucket's CORS policy is set according to the documentation:
Despite this CORS policy allowing both GET and HEAD methods from any origin, the issue persists. This suggests that the problem might be related to how DuckDB-Wasm handles the pre-signed URLs rather than the bucket's CORS configuration.
A possible solution might be to skip the HEAD request for pre-signed URLs or implement exception handling to proceed with the range GET request even if the HEAD request fails.
Browser/Environment:
Chrome 128.0.6613.138
Device:
M2 Macbook Air
DuckDB-Wasm Version:
1.28.1-dev278.0
DuckDB-Wasm Deployment:
shell.duckdb.org
Full Name:
Koji Mizoguchi
Affiliation:
TechTalk Inc.
The text was updated successfully, but these errors were encountered: