CORS with Companion and Serverless on AWS

Kudos on Companion guys!!

I found that after setup, I couldn’t get CORS to work properly. Here’s what worked for me:

Initialize CORS with options and then set the options on the app

    var corsOptions = {
      origin: '*',
      methods: "GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS",
      optionsSuccessStatus: 200
    }

    app.use(cors(corsOptions))

Add before use(companion:

app.options('*', cors(corsOptions));
app.use(companion.app(options))

thank you for this, i had the problem with CORS and this helped me