amplify-hosting
amplify-hosting copied to clipboard
Caching for `.next/` does not work properly
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
App Id
d21r43dw0zppd5
Region
ap-northeast-1
Amplify Console feature
Build settings
Describe the bug
I have put .next/cache/**/* into cache section in amplify.yml, however, Frontend section in Build logs continuously shows warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache. This makes build time longer than expected.

Expected behavior
Caching for .next/cache/ is effective, and build becomes faster.
Reproduction steps
- Connect a GitHub repository, which contains Next.js and SSR samples
- Add
- .next/cache/**/*into cache section in build setting (amplify.yml) in AWS Console - Trigger a build by pushing some modifications to GitHub
- See the build progress
- When the build is completed, inspect log messages in
Build->Frontend
Build Settings
version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- .next/cache/**/*
Additional information
No response
Hi :wave:, thanks for opening! While we look into this...
If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.
Lastly, please make sure you've specified the App ID and Region in the issue!
I am getting a similar warning and with the same amplify.yml config. Did you manage to find a fix for this?
Hi. Same question. Any update? I'm also getting the same warning and yes the build is very slow.
Any Update?
Still facing the same issue. A simple hello world build is taking over 9-mins to deploy No build cache found. Please configure build caching for faster rebuilds.
Same issue adding - .next/cache/**/* to cache paths has no effect in build time
Same issue here, adding - .next/cache/**/* on amplify.yml has no effect over the build process
Facing this issue as well and no matter what I try it fails to cache
Same issue here
I'm having this same issue. Anyone have any new insights?
Tried using single quotes (matching the comment above), but we're still not seeing build caching:
2022-09-19T11:12:35.336Z [INFO]: docs build: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
Same issue
+1
+1
+1
+1
Hi everyone,
I am pleased to share we have now launched support for Next.js 12 and 13. This new release improves build catching for Next.js projects. For more information, please see our blog post at https://aws.amazon.com/blogs/mobile/amplify-next-js-13
If you run into issues with Next.js 12 or 13, please open a new issue so we can track it specifically. Thank you everyone for your patience and support. It's much appreciated.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.