Static Web App not deploying API functions

Joe Washek 20 Reputation points
2024-06-14T20:52:26.2+00:00

Hello,

I've been struggling with this for a few days. I've read other posts online that are similar to this, but not exactly my experience. Here's the problem:

I have a static webapp (react front end, typescript functions). I'm using the standard GitHub Actions workflow for deploying via pull requests to a preview environment in Azure (Azure/static-web-apps-deploy@v1). Everything was working fine up to this week. The GitHub Action deploys successfully, no fatal errors, and the Azure environment is updated. I can browse to both the Preview environment and production sites; the UI works fine. However, none of the API functions get deployed. I do not see any errors in the GitHub actions. In fact, it shows strong evidence the API build step is completing successfully. But all API calls from the client return 404, and when I view the application in VS Code, and expand the Functions node, it says there are no functions.

Everything compiles are runs fine locally using the swa cli. There should be 8 functions. I have attached some pictures.

User's image

User's image

User's image

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
839 questions
{count} votes

Accepted answer
  1. ajkuma 24,566 Reputation points Microsoft Employee
    2024-06-27T09:13:09.4366667+00:00

    Summarizing the issue and solution, to benefit the community.

    Scenario: I have a static web application built with a React frontend and TypeScript functions. Deployment is handled via GitHub Actions using the Azure/static-web-apps-deploy@v1 action. Previously, the deployment process was functioning correctly, deploying both the frontend and the API functions to Azure.

    User's image

    Issue: After successfully deploying my static web application via GitHub Actions to Azure, the API functions are no longer visible or accessible. Despite the GitHub Action indicating successful deployment and no apparent errors during the deployment process, attempts to access any API endpoints result in a 404 error.

    Local testing using the SWA CLI confirms that the application should include 8 API functions, but these do not appear in the deployed Azure environment.

    Posting the solution shared by Joe Washek

    Solution:

    Moved all the npm dev dependencies to regular dependencies, and the functions show up now.


    > please click Accept Answer - it will benefit the community/users to find the answer quickly.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Joe Washek 20 Reputation points
    2024-06-16T02:00:08.99+00:00

    This can be closed. I moved all the npm dev dependencies to regular dependencies, and the functions show up now.