Azure using Data API Builder Fails

Joe OConnor 5 Reputation points
2025-02-19T16:38:41.52+00:00

I have configured one successful Blazor Web Assembly Static Web App with Data Api Builder and it is running correctly and this Postman works

Get - https://nice-pebble-0d420e91e.4.azurestaticapps.net/data-api/rest/Products

However, when I build another on on a different machine https://orange-tree-0f689cc1e.4.azurestaticapps.net Postman fails.

Get - https://orange-tree-0f689cc1e.4.azurestaticapps.net/data-api/rest/Products

Fails with 500Internal Server Error

The url for that Blazor Web Assembly project is

var apiBaseUrl = "https://orange-tree-0f689cc1e.4.azurestaticapps.net/";

fullApiUrl = $"{apiBase}/data-api/rest/Products";

And the page reports

Access to fetch at 'https://nice-pebble-0d420e91e.4.azurestaticapps.net/appsettings.json' from origin 'https://orange-tree-0f689cc1e.4.azurestaticapps.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

But it should be calling the API at https://orange-tree-0f689cc1e.4.azurestaticapps.net not https://nice-pebble-0d420e91e.4.azurestaticapps.net/appsettings.json which is what the first project uses

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,081 questions
0 comments No comments
{count} votes

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.