Serverless tutorial bug with CORS config

This is a question about the Serverless Stack tutorial at https://serverless-stack.com/.

During the segment “Create an S3 Bucket for File Uploads”, I am configuring CORS by typing in the recommended block of XML into the editor. This XML is rejected with API response “Expected params.CORSConfiguration.CORSRules to be an Array”.

The XML is well-formed and valid, and seems to conform to the rules of CORS configuration shown in the AWS documentation link below. Is there a fix?

Thanks

Ok, I can narrow the problem down. It is happening for me only in the “new” version of the S3 Bucket UI. If I switch to the old version, I can enter the CORS configuration with no difficulty.

1 Like

Oh that’s super weird. Glad you figured out the issue.

I encountered the same error. Turns out, S3 now expects the rules to be an array JSON format. For those who encounters this same error, please see new format below. :slight_smile:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "POST",
            "HEAD",
            "DELETE"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

i am also having trouble with this.

I copied and pasted
[
{
“AllowedHeaders”: [
"
],
“AllowedMethods”: [
“GET”,
“PUT”,
“POST”,
“HEAD”,
“DELETE”
],
“AllowedOrigins”: [
"

],
“ExposeHeaders”: [],
“MaxAgeSeconds”: 3000
}
]

and gave me the same error.

Hmm the one you posted seems different from the one above?

Thanks all. Updating the new chapter with this: