fix(s3): list bucket via plain fetch to avoid CORS preflight rejection#871
Open
PaulHax wants to merge 1 commit intoKitware:mainfrom
Open
fix(s3): list bucket via plain fetch to avoid CORS preflight rejection#871PaulHax wants to merge 1 commit intoKitware:mainfrom
PaulHax wants to merge 1 commit intoKitware:mainfrom
Conversation
`@aws-sdk/client-s3` attaches `x-amz-content-sha256`, `x-amz-user-agent`, `amz-sdk-invocation-id`, and `amz-sdk-request` headers, which force a CORS preflight. Buckets whose `AllowedHeaders` rule doesn't cover them reject the preflight, breaking `s3://` URI loading even for public anonymous buckets (reproduced against IDC's `idc-open-data` and `idc-open-data-two`, issue Kitware#869). Replace the SDK-driven `ListObjectsV2Command` with a plain `fetch()` of the same XML endpoint. The request becomes CORS-simple (no preflight), and the SDK dependency is dropped entirely. - Adds retry with exponential backoff and jitter (3 attempts) on transient 5xx / 408 / 429 / network errors. - Tests cover listing, pagination, retry, retry-exhaustion, and a no-custom-headers invariant guarding against regression. - `@aws-sdk/client-s3` removed from devDependencies.
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@aws-sdk/client-s3attachesx-amz-content-sha256,x-amz-user-agent,amz-sdk-invocation-id, andamz-sdk-requestheaders, which force a CORS preflight. Buckets whoseAllowedHeadersrule doesn't cover them reject the preflight, breakings3://URI loading even for public anonymous buckets (reproduced against IDC'sidc-open-dataandidc-open-data-two, issue #869).Replace the SDK-driven
ListObjectsV2Commandwith a plainfetch()of the same XML endpoint. The request becomes CORS-simple (no preflight), and the SDK dependency is dropped entirely.@aws-sdk/client-s3removed from devDependencies.