Configure Node.js server code to fix CORS error

Job ID: 34408088

Budget: $10 – $20 USD

I’m getting an error saying the following (below) from my server (Node/Express using Firebase Functions). I'm using Angular2 v7 on the front end. This cloud function executes fine from my localhost, but not from my production server. I will go into further details after selecting the freelancer for security reasons.

It was working fine until a few weeks ago; I ran into an issue where it wasn't updating my Firebase Functions so I had to delete the package-lock.json when deploying the project get that working again. I spent the entire day today trying multiple things but couldn't get it working. I'm open to using a desktop administration tool like TeamViewer so you can remote in and fix it.

CORS error message:
"[website] has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

Pastebin of my index.js (Firebase Functions) code: https://pastebin.com/pPehrB2n
(I replaced the website's name with 'website' in `const allowedOrigins` variable for the moment)
Related categories: Node.js Express JS HTTP Google Firebase Angular