Search code examples
catalystbyzohozohocatalyst

CORS error in browser after allowing cross-origin requests in backend of my application and also in Zoho Catalyst Console


I'm working with a Zoho Catalyst application hosted on AppSail, where I've deployed a Next.js application. I am using the Catalyst Advanced I/O Node.js function for a remote function within the same project. However, I'm facing a CORS error in the browser when making API calls.

I’ve configured CORS settings in both the Catalyst console and my backend server to allow cross-origin requests with '*'. I have verified that the backend logic is working since data is being successfully entered into the datastore. Despite this, I am still seeing a CORS error in the browser.


Solution

  • The CORS error occurs because you have enabled the CORS in your Function code and also in the catalyst console so that when fetching the resource from the Appsail domain to the Functions domain throwing the CORS error. To resolve this, kindly remove the CORS-related code from your function and try fetching the resources again from the AppSail domain to the Functions domain.

    After removing the CORS configuration from your function, try fetching the resources again, and this should resolve the CORS error.