Getting CORS error client-side by uploading file to the v2/file endpoint from nextjs

Hello,

i try to upload a file from client-side nextjs app with fetch to teh v2/file endpoint and getting the knowing CORS error. If i use the same setting at postman everything works with 200. It also works on the client-side with Moesif extension enabled. I also tryed it with the sdk and getting an 500 error because of the using v2 endpoint. It is a pain and took me hours.

Is there any solution? Can someone help me who had the same problems.

I also try the guide from @[Alex Savchuk] with no success.

Thanks for any help!

-Tobi

Just to let you know, I have the same problem. I have a client-side app and have been using the v2 endpoint, but it stopped working a few days ago. The v2/file endpoint is returning a CORS error. I hope someone has a solution for this.

Hi Goran,

the two endpoints v2 and v2/file are definitely different due to this cors error. The problem is that the OPTIONS preflight of the browser is not successfully. I found a temporary solution, by setting a proxy (cors-anywhere) as url prefix https://proxyurl…/api.monday.com:443/v2/file and the upload works fine, because the proxy passes through the browser’s preflight and forwards the request to monday.
I have the proxy server running on my K8S environment, but there are other ways to host it. So far this solution is working great. I will change it as soon as the endpoint responds normally again.

Probably monday has different cors settings on the file endpoint than on the v2 endpoint. Maybe it will be solved in the near future.

I hope my solution will help you and others too, if you have any further questions please contact me.

Best regards
Tobi

Hi Tobias,

thank you for your solution. I was trying to avoid running a server for these Monday apps, but it seems that I will have to.