Next.js Discord

Discord Forum

CORS Error while submitting a form

Unanswered
Hassib posted this in #help-forum
Open in Discord
I have a form on my website that after its submission the data is supposed to be stored in Postgres on Vercel. Everything works fine on development, but it throws the CORS error whenever I deploy it on Vercel.

Here's the error:

Access to fetch at 'https://somelink' from origin 'https://www.somelink.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
page-0e40bffa4a08f628.js:1 
      
POST https://somelink/api/appointment net::ERR_FAILED


Note: I'm using the API endpoint of my Next.js project in a client component. The data is being stored using Prisma.

0 Replies