This is really a note for me so I can find it in the future. So, future me, if you are having the following problem, you are running a local dev environment that has an SPFX application (mine was a Teams App running in Teams workbench) and a local Azure Function.
For some reason, you are calling your API, but you keep getting a fetch error, no matter what you do. You read about various people complaining about CORS errors, but you think, “Nah, it’s nothing to do with that.”
Your API gets called successfully and you step through the function but between the return and switching back to your VS Code it errors.
Well, check your local.settings.json for the following entry and add it if missing.
"Host": {
"LocalHttpPort": 7165,
"CORS": "*"
}
The real hero is Eli, who provided the fix via her blog post, thanks Eli, I will be buying you a coffee!



