Skip to content

S3 listBuckets CORS is not availableΒ #6608

@kesor

Description

@kesor

According to SERVICES.md the S3 service is CORS enabled. And yet calling listBuckets when using aws-sdk.js in a browser, fails to work because the services is not enabled with CORS.

I'm using aws-sdk.js version

AWS.VERSION
"2.188.0"

The code running in the browser is just

AWS.config.credentials = new AWS.Credentials({ accessKeyId: "...", "secretAccessKey": "..." })
const s3 = new AWS.S3({ region: "us-east-1" })
s3.listBuckets()

Getting this result in the console

aws-sdk.min.js:47 OPTIONS https://s3.eu-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ca-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ca-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-south-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-south-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-east-2.amazonaws.com/ net::ERR_ABORTED
(index):1 Failed to load https://s3.us-east-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-south-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-south-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ca-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ca-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-east-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-east-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ca-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ca-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-south-1.amazonaws.com/ net::ERR_ABORTED
(index):1 Failed to load https://s3.ap-south-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-1.amazonaws.com/ net::ERR_ABORTED
(index):1 Failed to load https://s3.eu-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.sa-east-1.amazonaws.com/ net::ERR_ABORTED
(index):1 Failed to load https://s3.sa-east-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-east-2.amazonaws.com/ net::ERR_ABORTED
(index):1 Failed to load https://s3.us-east-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ca-central-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ca-central-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-east-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-east-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.eu-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.eu-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.sa-east-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.sa-east-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-south-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-south-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.sa-east-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.sa-east-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.sa-east-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.sa-east-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.us-west-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.us-west-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-southeast-2.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-southeast-2.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.
aws-sdk.min.js:47 OPTIONS https://s3.ap-northeast-1.amazonaws.com/ 403 (Forbidden)
(index):1 Failed to load https://s3.ap-northeast-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.

Metadata

Metadata

Assignees

Labels

documentationThis is a problem with documentation.p2This is a standard priority issueservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions