node-next-gae-demo
node-next-gae-demo copied to clipboard
Hit per folder limit.
@blainegarrett have you faced this?
DEBUG: (gcloud.app.deploy) Error Response: [3] The directory [.next/cache/next-babel-loader] has too many files (greater than 1000).
@alacret I have not. Is it possible you are not clearing the build directory between builds? Try running rimraf or rm -rf as part of the build process.
Note to self: If we run rm -rf
as part of the npm run build
npm script, we should really obey the next.config distDir setting. The code base sets it to "build" since ".next" default was originally not supported by GAE due to the leading dot prefix.
I'm clearing the build directory on build. Still have this issue. Currently can't deploy the NextJS project. Also who's idea was it to use .next?
(breaking lots of standards).
The second issue is there's no index.js for our security validation services...
@ollydixon Are you deploying locally or via build tools? i.e. google cloud build, etc.
@blainegarrett doing local build then deploying via Cloud Builder (just file upload) but it caps 1000 files per directory for obvious reasons.
@ollydixon One more question, are you deploying to AppEngine standard environment? What's your deploy step look like in your Cloud Build directives?
It has been a while, but I remember when running gcloud deploy inside a Google Cloud Build step npm install is run automatically
. As such, it functions just like as if you were deploying locally. The existing .gcloudignore in this repo has the .gcloudignore itself skipped. As such, when the deploy build step runs, it doesn't see the .gcloudignore file and tries to push everything in the build workspace.
If you are using Cloud Builder as a CI/CD workflow, and have a npm install
or yarn install
step in order to run tests, you will have the node_modules directory still around. Before running the deploy step, you may consider either cleaning up the workspace or moving in place a new .gcloudignore file that is specific to the build deploy. Alternately, if the skip directives are exactly the same for local deploy and deploy via the builder, just remove the .gcloudignore line from the .gcloudignore file.
I had a similar issue with .env files. I wanted to ensure the local .env developer file was skipped if present from local deploy. However, I needed to move into place a .env file for testing purposes. Finally, I needed to move into place the prod .env file prior to deploy. My .env files were encrypted using KMS and stored in Cloud Storage.
Let me know if you get stuck, I can sift through backups and see if I can find my Cloud Build file.
@blainegarrett I fixed the issue. The NextJS build steps should take care of this but it doesn't clear the cache directory as well (cache). I had another issue on here but someone deleted it explaining it there. Never had someone delete an issue before was sort of rude. :-/
The fixed deploy looks like this rm -rf ./build && npm run build && rm -rf ./build/cache && y | gcloud app deploy --project cyberpunk2077 app.yaml
@ollydixon Good find. I wonder if I should start a FAQ section on here. Would you have any interest in contributing?
@blainegarrett I don't actually develop, my developers are doing NestJS; I just manage 34 teams so I don't really have time for that hehe :-D thanks for the offer though. I hope this helps someone.