1

So, I am building a very simple react app with a node back end on a lambda and an API gateway between the front end and the lambda. I have consistently gotten a cors error or a weird error of ...

The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

I finally realized that when I run the sam package command, it is placing additional quotes around some parameters - namely those related to cors.

Globals:
  Function:
    Timeout: 3
  Api:
    Cors:
      AllowOrigin: '''*'''
      AllowHeaders: '''Content-Type'''
      AllowMethods: '''OPTIONS,POST,DELETE,GET,PUT'''

I've tried single quotes, double quotes, and combinations of the two and nothing works. I am using VS code and I don't think that it is part of any pretty-print as it isn't happening on save. It's during the last part of the package.

Joshua Foxworth
  • 1,236
  • 1
  • 22
  • 50

0 Answers0