CORS error when using durable functions with staic webapp

kanna 106 Reputation points
2022-02-19T09:54:38.213+00:00

I have modified existing application to use durable functions, now frontend tries to get status by accessing statusQueryGetUri but I'm getting CORS error
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

and following error when I try to access statusQueryGetUri my self in the browser

{"code":400,"message":"Login not supported for provider azureStaticWebApps"}

Do I have to configure anything on portal to allow access to statusQueryGetUri url from static web app, the function app is linked to static webapp already.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Gerwin de Kruijf 0 Reputation points
    2024-02-27T13:16:26.6633333+00:00
    • In my Vue frontend, I used VUE_APP_BASE_URL to point to the backend api. The problem I had was that my api endpoints were like: /chat, /login, etc. However, I had to change these to /api/chat, api/login for both the backend en the frontend. Then it worked.
    • Also make sure that your Azure Static Web App has your backend as API listed. Go to your Azure Static Web App in Azure Portal, go to API's, then add your Web service.
    • Make sure that CORS is enabled in your backend for the static web app url
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.