It all began by attempting to over-engineer issues with an Azure Function. And then it wouldn’t work! This weblog submit is generally for me in order that I can discover these things later after I inevitably hit the identical CORS concern.
Invoking this led to the next error:
Access to fetch at ' from origin ' has been blocked by CORS coverage: No 'Access-Control-Allow-Origin' header is current on the requested useful resource. If an opaque response serves your wants, set the request's mode to 'no-cors' to fetch the useful resource with CORS disabled.
A number of Google outcomes later, I discovered this StackOverflow query:
The reply right here confirmed that this can be a CORS configuration on the Azure facet that must be completed within the Portal. From Visual Code I right-clicked on my Azure operate and chosen Open in portal:
This popped open the Azure Portal to the proper operate in my subscription. On the left pane, I then scrolled right down to the API part and chosen CORS.
A CORS administration panel masses up the place I can enter allowed origins:
From right here I may add my native growth URL and the whole lot labored! HOORAY!
Obviously, afterward I should add any staging or manufacturing internet hosting domains as properly, however for now, I can transfer ahead.