I've just spent several hours trying to fix it. Turned out I had a wrong import at the top of one of my api files. When Azure runs all files to register the handlers, any error before the app.http
call stops the process and none of the other handlers are registered.
404 static web app azure function TS
I am using Azure static web app and managed azure function. This is an angular app. swa build and build and deploy works fine. Everything shows success and I can but the endpoints locally. However when I deploy with the cli or with git hub actions and I hit the endpoints via UI on /app/myFunction I get 404 not found. Just azure functions are not being hit.
Azure Functions
Azure Static Web Apps
3 answers
Sort by: Most helpful
-
Artem Smirnov 30 Reputation points
2023-12-11T11:26:30.0833333+00:00 -
Amy Kline 75 Reputation points
2023-05-23T20:01:22.12+00:00 To resolve the 404 error you're encountering when accessing Azure Functions in your Angular app deployed as an Azure Static Web App, follow these steps:
- Verify Function App deployment and configuration.
- Check the routing configuration in your Angular app.
- Ensure the base URL for Azure Functions is correct.
- Validate Azure Static Web App configuration.
- Check deployment logs for errors or warnings.
- Verify access restrictions or authentication settings.
- Test Azure Functions locally to isolate the issue.
- Review Azure Function logs for errors.
By following these steps, you can troubleshoot and resolve the issue causing the 404 error.
-
Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
2023-05-23T21:33:01.1833333+00:00 Managed API defaults to
/api/functionname
. The platform will automatically forward requests to that endpoint. If you're getting 404s, the only thing I can think of is your you never updated the output dir for your deployment.Using swa cli, this is the
--api-location
argument. In yaml, it's theapi_location
argument. Try http repl tohttps://<swa-host-name>.staticwebapps.net/api/functionname
to call the endpoint directly to confirm.