amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

Caching for `.next/` does not work properly

Open esplo opened this issue 3 years ago • 13 comments

Before opening, please confirm:

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. Screen Shot 2021-12-08 at 18 13 49

Expected behavior

Caching for .next/cache/ is effective, and build becomes faster.

Reproduction steps

  1. Connect a GitHub repository, which contains Next.js and SSR samples
  2. Add - .next/cache/**/* into cache section in build setting (amplify.yml) in AWS Console
  3. Trigger a build by pushing some modifications to GitHub
  4. See the build progress
  5. 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

esplo avatar Dec 08 '21 09:12 esplo

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!

github-actions[bot] avatar Dec 08 '21 09:12 github-actions[bot]

I am getting a similar warning and with the same amplify.yml config. Did you manage to find a fix for this?

3kumar avatar Feb 09 '22 15:02 3kumar

Hi. Same question. Any update? I'm also getting the same warning and yes the build is very slow.

april-swellfox avatar Feb 12 '22 00:02 april-swellfox

Any Update?

sufiyank97 avatar Feb 12 '22 10:02 sufiyank97

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.

dhruvsaxena1998 avatar Mar 15 '22 16:03 dhruvsaxena1998

Same issue adding - .next/cache/**/* to cache paths has no effect in build time

josefernand avatar Mar 15 '22 18:03 josefernand

Same issue here, adding - .next/cache/**/* on amplify.yml has no effect over the build process

mfgomezb avatar Jun 22 '22 16:06 mfgomezb

Facing this issue as well and no matter what I try it fails to cache

rszemplinski avatar Jul 05 '22 23:07 rszemplinski

Same issue here

bunge12 avatar Aug 24 '22 20:08 bunge12

I'm having this same issue. Anyone have any new insights?

wobble-house avatar Sep 08 '22 16:09 wobble-house

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

ctotheameron avatar Sep 19 '22 11:09 ctotheameron

Same issue

LerGG avatar Sep 19 '22 20:09 LerGG

+1

mr-rpl avatar Oct 13 '22 17:10 mr-rpl

+1

michaelworm avatar Nov 02 '22 16:11 michaelworm

+1

ChristopherBanas avatar Nov 06 '22 17:11 ChristopherBanas

+1

d-spindola avatar Nov 16 '22 22:11 d-spindola

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.

calavera avatar Nov 17 '22 20:11 calavera

⚠️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.

github-actions[bot] avatar Nov 17 '22 20:11 github-actions[bot]

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.

github-actions[bot] avatar Nov 17 '22 21:11 github-actions[bot]