Google Storage ArgumentException when setting CORS config
I got the same error when I tried to set the CORS settings with the trailing comma "," as shown below:
[
{
"origin": ["http://localhost:8000"],
"method": ["GET"],
"responseHeader": ["Content-Type"],
"maxAgeSeconds": 3600,
} // ↑ Trailing comma
]
So, I removed the trailing comma "," as shown below then I could set the CORS settings successfully without no error:
[
{
"origin": ["http://localhost:8000"],
"method": ["GET"],
"responseHeader": ["Content-Type"],
"maxAgeSeconds": 3600
} // ↑ No trailing comma
]
after so many tries, I ended up with modifing json file to:
$ cat cors-json-file.json
[{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}]
and... it worked! Note that example from Google documentation is my first case (with [{ on 2 lines)
I had the same problem and it was caused by the type of quotes used. By opening the json-file in a plain text editor and change the quote to standard ones fixed the problem.