Render Deployed URL gives Cors Error after some time of usage

Here’s a link to the repository

Am using Node v18
Browser is Chrome
I tried all the ways to resolve CORS error , but to my surprise this work on locahost , but not on the deployed link
This issue has been raised as well , I guess Render Community should take this issue seriously

Am a fresh grad and this is one of my projects , a non-working project can put me in a bad place and give bad impression to the employers
Therefore I request the team to look into this

1 Like

bro same issue with me also🥲

Assuming that you use express with node, to fix the cors problem you need to install

npm install cors or yarn add cors

After is installed add it to your middleware.

var cors = require('cors') // or import cors from "cors" if you use ts or some sort of bundler
var app = express()


If you do the above you will have the default configuration, but use the link above to get familiar with the documentation.

  "origin": "*",
  "preflightContinue": false,
  "optionsSuccessStatus": 204

That should resolve all your cors problems.

I’ve fixed this for my express API so is quite a funny coincidence to see it as the first question given that I’ve just joined the community. :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.