CORS problem with PUT method

Hi all,

I am trying to implement the ‘update’ note, but whenever I try to send an update using

dynamoDbLib.call("update", params);

I get an error saying that:

Access to XMLHttpRequest at '**' from origin '**' has been blocked by CORS policy:
Method PUT is not allowed by Access-Control-Allow-Methods in preflight response.

(of course the ‘*’ are the actual addresses that I removed)

I was doing everything that I read online, I made sure that my CORS rule is the same as what is shown on the tutorial, I made sure that the serverless.yml file is good, I also added this to my ‘response-lib.js’:

      headers: {
        "Access-Control-Allow-Origin": '*',
        "Access-Control-Allow-Credentials": true,
        "Access-Control-Allow-Methods": 'GET,POST,PUT,DELETE,OPTIONS',
        "Access-Control-Allow-Headers": 'Origin, X-Requested-With, Content-Type, Accept, Z-Key'
      },

But still no success… I added the logs to my bucket, but it seems like no log is being added, it seems my connection is being blocked from my end, and I have no idea what to do to fix this.

Thank you for your help!

This line:

dynamoDbLib.call("update", params);

Is that in your React app or your Lambda function?