Search code examples
google-app-enginegoogle-cloud-platformpipplaid

Error Response: has too many files (greater than 1000). gcloud app deploy


We are deploying an application in Google App Engine. Ours is a standard engine on python 3.7.

Here is the requirements.txt file

 apiclient
 firebase_admin
 google.auth
 jinja2
 pytz
 stripe
 flask
 gunicorn
 requests
 requests_toolbelt
 google-cloud-tasks
 plaid-python

We are getting the following error when we deploy the application. There are only a total of 7654 files in total inside the lib folder.

  ERROR: (gcloud.app.deploy) Error Response: [3] The directory [lib/plaid/model] has too many files (greater than 1000).

Solution

  • Normally, the number of files for an App is 10,000 (see documentation) but maybe there's a limit of 1000 per folder

    For GAE Standard, Python 2.7 doesn't use the requirements.txt file. This means you would have installed all the contents of that file in your lib folder and that folder gets uploaded (deployed) to Google. The number of files in that folder has passed 1000 (that's the error you're getting).

    You should switch to Python 3. For Python 3, Google uses your requirements.txt file. Add your virtual environment folder to the .gclooudignore file so that when you deploy, your virtual env folder won't get deployed. During deploy, Google will install the contents of your requirements.txt file directly in cloud

    Another reason you should switch to Python 3 is that Google has moved all new development to Python 3 ( I think they'll officially stop supporting Python 2 sometime next year; not 100% sure of this though)