SWA deployment failed with the Reason: The size of the function content was too large

Vadim Parfaniuc - US 0 Reputation points
2025-05-01T16:46:04.6533333+00:00

Hello, we started receiving the following error message when deploying new builds to SWA, however, we are on the Standard plan and the size of the build should be set to 500Mb. Please advise.

Done Zipping Api Artifacts

The content server has rejected the request with: BadRequest

Reason: The size of the function content was too large. The limit for this Static Web App is 262144000 bytes.

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

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 19,076 Reputation points Moderator
    2025-05-01T23:08:25.97+00:00

    Yes, that is correct Vadim Parfaniuc - US.

    Given that your .next folder is already small (28MB), so focus should be on reducing the size of the node_modules folder associated with your Azure Functions as shared on this similar thread on github.

    One of the workaround is to Run **npm install --production or yarn install --production **within your api directory. This will install only the dependencies needed for production, excluding development dependencies.

    You should also review your api/package.json file and remove any unnecessary dependencies. If you're using a build process for your functions (e.g., for TypeScript), please make sure that the build output only includes the necessary files and dependencies.


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.