Error received when deploying App Engine Standard app

Problem

When trying to deploy a new App Engine standard environment app that has 10,000 files or more, you see the following error:

ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: This deployment has too many files. New versions are limited to 10000 files for this app.

Environment

  • App Engine standard environment

Solution

There are several options to work around this limitation:

  1. Reduce the number of files associated with this app.
  2. Use Cloud Storage to store static resources.
    You can store your static resouces in a Google Cloud Storage bucket and retrieve those files from the bucket as needed. However, this change may impact your monthly expenses.
  3. Open a support case to request an increase to the file limit.
    Please note that these requests are reviewed on a case-by-case basis and may not be approved. If this limit is preventing you from pushing changes to your production environment, choose one of the previous two options for a more timely resolution.

Cause

This is a default limit. Assuming you have access to a UNIX-based operating system, you can count the number of files in source control or a local staging directory by running this command:

find . -type f | wc -