Hello Beau
There are two things you can check.
- This could be a CORS issue. Use online tools like test-cors.org to check if your API supports CORS requests. This tool allows you to send CORS requests to a remote server or a test server and provides feedback on whether CORS is functioning as expected. Here’s how you can use it: Visit test-cors.org. Enter your Azure Function API URL (e.g., the auto-generated web app URL + API route). Click the “Send CORS Request” button. Inspect the response to see if the necessary CORS headers are present.
- The CORS can be set up in your host.json.
- Check the logs of the Azure function and see if the requests are accepted in the first place. Are you also using the function keys in your request?
- You can check if this is a CORS issue adding the following code to your Azure Function API's
Startup.cs
file:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// ...
app.UseCors(builder => { builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); });
// ...
}
- Another possible reason for this issue could be that your Azure Function API is not deployed correctly. You can check if this is the case by navigating to your Azure Function API's URL in a web browser. If you receive an error message, then your Azure Function API is not deployed correctly.