Skip to content

Monorepo: Cache Support #500

Closed
Closed
@tmilewski

Description

@tmilewski

Describe the bug
It appears that when using the monorepo documentation (nx), that the Next.js caching mechanisms in place don't seem to find anything to cache.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/netlify/netlify-plugin-nextjs/blob/main/docs/monorepos.md#nx
  2. Follow the directions verbatim.
  3. Build => 2 times
  4. See that the cache isn't saved or restored.

Expected behavior
A cache of the built sites should persist between builds.

Versions

  • Next.js: 10.2.3
  • @netlify/plugin-nextjs@3.6.3
11:28:24 AM: ────────────────────────────────────────────────────────────────
11:28:24 AM:   Netlify Build                                                 
11:28:24 AM: ────────────────────────────────────────────────────────────────
11:28:24 AM: ​
11:28:24 AM: ❯ Version
11:28:24 AM:   @netlify/build 15.5.0
11:28:24 AM: ​
11:28:24 AM: ❯ Flags
11:28:24 AM:   deployId: 60e719744750790008ae464b
11:28:24 AM: ​
11:28:24 AM: ❯ Current directory
11:28:24 AM:   /opt/build/repo
11:28:24 AM: ​
11:28:24 AM: ❯ Config file
11:28:24 AM:   /opt/build/repo/netlify.toml
11:28:24 AM: ​
11:28:24 AM: ❯ Context
11:28:24 AM:   deploy-preview
11:28:24 AM: ​
11:28:24 AM: ❯ Loading plugins
11:28:24 AM:    - ./tools/plugins/netlify/stop-build@0.0.0 from netlify.toml
11:28:24 AM:    - netlify-plugin-contextual-env@0.3.0 from netlify.toml
11:28:24 AM:    - @netlify/plugin-nextjs@3.6.3 from netlify.toml and package.json
11:28:25 AM: ​
11:28:25 AM: ─────────────────────────────────────────────────────────────────
11:28:25 AM:   1. onPreBuild command from ./tools/plugins/netlify/stop-build  
11:28:25 AM: ─────────────────────────────────────────────────────────────────
11:28:25 AM: ​
11:28:25 AM: ​
11:28:25 AM: (./tools/plugins/netlify/stop-build onPreBuild completed in 29ms)
11:28:25 AM: ​
11:28:25 AM: ────────────────────────────────────────────────────────────────
11:28:25 AM:   2. onPreBuild command from netlify-plugin-contextual-env      
11:28:25 AM: ────────────────────────────────────────────────────────────────
11:28:25 AM: ​
11:28:25 AM: Exporting ...
11:28:25 AM: Replaced 11 ENVs
11:28:25 AM: ​
11:28:25 AM: (netlify-plugin-contextual-env onPreBuild completed in 9ms)
11:28:25 AM: ​
11:28:25 AM: ────────────────────────────────────────────────────────────────
11:28:25 AM:   3. onPreBuild command from @netlify/plugin-nextjs             
11:28:25 AM: ────────────────────────────────────────────────────────────────
11:28:25 AM: ​
11:28:25 AM: Using Next.js 10.2.3
11:28:25 AM: info  - Using webpack 4. Reason: future.webpack5 option disabled https://nextjs.org/docs/messages/webpack5
11:28:26 AM: Detected Nx site. Checking configuration...
11:28:26 AM: No Next.js cache to restore.
11:28:26 AM: ​
11:28:26 AM: (@netlify/plugin-nextjs onPreBuild completed in 1.1s)
11:28:26 AM: ​
11:28:26 AM: ────────────────────────────────────────────────────────────────
11:28:26 AM:   4. Build command from Netlify app                             
11:28:26 AM: ────────────────────────────────────────────────────────────────
11:28:26 AM: ​
11:28:26 AM: $ yarn nx build base --configuration=production
11:28:26 AM: yarn run v1.22.10
11:28:26 AM: $ nx build base --configuration=production
11:28:27 AM: > nx run base:build:production
11:28:29 AM: info  - Using webpack 4. Reason: future.webpack5 option disabled https://nextjs.org/docs/messages/webpack5
11:28:30 AM: info  - Using webpack 4. Reason: future.webpack5 option disabled https://nextjs.org/docs/messages/webpack5
11:28:30 AM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
11:28:30 AM: info  - Checking validity of types...
[ BUILD INFORMATION ] 
11:30:10 AM: >  NX   SUCCESS  Running target "build" succeeded
11:30:10 AM: >  NX   CLOUD  See run details at https://nx.app/runs/...
11:30:10 AM: Done in 103.54s.
11:30:10 AM: ​
11:30:10 AM: (build.command completed in 1m 43.7s)
11:30:10 AM: ​
11:30:10 AM: ────────────────────────────────────────────────────────────────
11:30:10 AM:   5. onBuild command from @netlify/plugin-nextjs                
11:30:10 AM: ────────────────────────────────────────────────────────────────
11:30:10 AM: ​
11:30:10 AM: Detected Next.js site. Copying files...
11:30:10 AM: ** Running Next on Netlify package **
11:30:10 AM: 🚀 Next on Netlify 🚀
11:30:10 AM: 🌍️ Copying public/ folder to /opt/build/repo/apps/base/out
11:30:10 AM: 💼 Copying static NextJS assets to /opt/build/repo/apps/base/out
11:30:10 AM: 💫 Setting up API endpoints as Netlify Functions in /opt/build/repo/netlify/functions
11:30:10 AM: 💫 Setting up pages with getInitialProps as Netlify Functions in /opt/build/repo/netlify/functions
11:30:10 AM: 💫 Setting up pages with getServerSideProps as Netlify Functions in /opt/build/repo/netlify/functions
11:30:10 AM: 🔥 Copying pre-rendered pages with getStaticProps and JSON data to /opt/build/repo/apps/base/out
11:30:10 AM: 💫 Setting up pages with getStaticProps and fallback: true as Netlify Functions in /opt/build/repo/netlify/functions
11:30:10 AM: 💫 Setting up pages with getStaticProps and revalidation interval as Netlify Functions in /opt/build/repo/netlify/functions
11:30:10 AM: 🔥 Copying pre-rendered pages without props to /opt/build/repo/apps/base/out
11:30:10 AM: Building 9 pages
11:30:10 AM: 💼 Copying WP4 dynamic import chunks to /opt/build/repo/netlify/functions/next_api_auth_nextauth/nextPage
11:30:10 AM: 💼 Copying WP4 dynamic import chunks to /opt/build/repo/netlify/functions/next_api_auth_generateToken/nextPage
11:30:10 AM: 🔀 Setting up redirects
11:30:10 AM: 🔀 Setting up headers
11:30:10 AM: ✅ Success! All done!
11:30:10 AM: ​
11:30:10 AM: (@netlify/plugin-nextjs onBuild completed in 102ms)
11:30:10 AM: ​
11:30:10 AM: ────────────────────────────────────────────────────────────────
11:30:10 AM:   6. Functions bundling                                         
11:30:10 AM: ────────────────────────────────────────────────────────────────
11:30:10 AM: ​
11:30:10 AM: Packaging Functions from netlify/functions directory:
11:30:10 AM:  - next_image.js
11:30:10 AM:  - next_api_auth_generateToken/next_api_auth_generateToken.js
11:30:10 AM:  - next_api_auth_nextauth/next_api_auth_nextauth.js
11:30:10 AM: ​
11:30:28 AM: Creating deploy upload records
11:30:29 AM: Starting post processing
11:30:28 AM: ​
11:30:29 AM: Skipping HTML post processing
11:30:28 AM: (Functions bundling completed in 17.9s)
11:30:28 AM: ​
11:30:30 AM: Post processing - header rules
11:30:28 AM: ────────────────────────────────────────────────────────────────
11:30:28 AM:   7. onPostBuild command from @netlify/plugin-nextjs            
11:30:30 AM: Post processing - redirect rules
11:30:28 AM: ────────────────────────────────────────────────────────────────
11:30:28 AM: ​
11:30:28 AM: No Next.js cache to save.
11:30:28 AM: ​
11:30:30 AM: Post processing done
11:30:30 AM: Site is live ✨
11:30:28 AM: (@netlify/plugin-nextjs onPostBuild completed in 7ms)
11:30:28 AM: ​
11:30:28 AM: ────────────────────────────────────────────────────────────────
11:30:28 AM:   8. Deploy site                                                
11:30:28 AM: ────────────────────────────────────────────────────────────────
11:30:28 AM: ​
11:30:28 AM: Starting to deploy site from 'apps/base/out'
11:30:28 AM: Creating deploy tree 
11:30:28 AM: 9 new files to upload
11:30:28 AM: 2 new functions to upload
11:30:29 AM: Site deploy was successfully initiated
11:30:29 AM: ​
11:30:29 AM: (Deploy site completed in 1.8s)
11:30:30 AM: ​
11:30:30 AM: ────────────────────────────────────────────────────────────────
11:30:30 AM:   Netlify Build Complete                                        
11:30:30 AM: ────────────────────────────────────────────────────────────────
11:30:30 AM: ​
11:30:30 AM: (Netlify Build completed in 2m 5.9s)
11:30:30 AM: Caching artifacts
11:30:30 AM: Started saving node modules
11:30:30 AM: Finished saving node modules
11:30:30 AM: Started saving build plugins
11:30:30 AM: Finished saving build plugins
11:30:30 AM: Started saving yarn cache
11:30:30 AM: Finished saving yarn cache
11:30:30 AM: Started saving pip cache
11:30:30 AM: Finished saving pip cache
11:30:30 AM: Started saving emacs cask dependencies
11:30:30 AM: Finished saving emacs cask dependencies
11:30:30 AM: Started saving maven dependencies
11:30:30 AM: Finished saving maven dependencies
11:30:30 AM: Started saving boot dependencies
11:30:30 AM: Finished saving boot dependencies
11:30:30 AM: Started saving rust rustup cache
11:30:30 AM: Finished saving rust rustup cache
11:30:30 AM: Started saving go dependencies
11:30:30 AM: Finished saving go dependencies
11:30:30 AM: Build script success
11:32:09 AM: Finished processing build request in 4m19.701369209s

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions