Error 500 on NextJs-Site

Hello,
I have a problem with a next-js site. I always get an error 500 after deploying, even though there are no errors in the logs (as far as i can tell). I hope anyone can tell me, if the error is on my side or a problem with netlify/next?
Thank you all very much!!

Site name: https://cheerful-taffy-64b3ce.netlify.app/
Custom Domain: https://lengershaus.com

Here are my logs from the deployment:

9:20:43 AM: build-image version: 3ffff9df3d5419545acc1b673a54de348174406d (focal)
9:20:43 AM: buildbot version: 5e61a99f29958b8aa3fd441571eb23975d453146
9:20:44 AM: Fetching cached dependencies
9:20:44 AM: Failed to fetch cache, continuing with build
9:20:44 AM: Starting to prepare the repo for build
9:20:44 AM: No cached dependencies found. Cloning fresh repo
9:20:44 AM: git clone --filter=blob:none https://github.com/Lengershaus/Lengershaus-web
9:20:44 AM: Preparing Git Reference refs/heads/main
9:20:46 AM: Starting to install dependencies
9:20:46 AM: Python version set to 3.8
9:20:46 AM: Attempting Ruby version 2.7.2, read from environment
9:20:47 AM: Using Ruby version 2.7.2
9:20:47 AM: Started restoring cached go cache
9:20:47 AM: Finished restoring cached go cache
9:20:47 AM: go version go1.19.13 linux/amd64
9:20:48 AM: Using PHP version 8.0
9:20:49 AM: v18.18.2 is already installed.
9:20:49 AM: Now using node v18.18.2 (npm v9.8.1)
9:20:49 AM: Enabling Node.js Corepack
9:20:49 AM: Started restoring cached build plugins
9:20:49 AM: Finished restoring cached build plugins
9:20:49 AM: Started restoring cached corepack dependencies
9:20:49 AM: Finished restoring cached corepack dependencies
9:20:49 AM: No npm workspaces detected
9:20:49 AM: Started restoring cached node modules
9:20:49 AM: Finished restoring cached node modules
9:20:49 AM: Installing npm packages using npm version 9.8.1
9:20:55 AM: added 307 packages, and audited 308 packages in 6s
9:20:55 AM: 106 packages are looking for funding
9:20:55 AM:   run `npm fund` for details
9:20:55 AM: found 0 vulnerabilities
9:20:55 AM: npm packages installed
9:20:56 AM: Successfully installed dependencies
9:20:56 AM: Starting build script
9:20:57 AM: Detected 1 framework(s)
9:20:57 AM: "next" at version "14.0.2"
9:20:57 AM: Section completed: initializing
9:20:58 AM: ​
9:20:58 AM: Netlify Build                                                 
9:20:58 AM: ────────────────────────────────────────────────────────────────
9:20:58 AM: ​
9:20:58 AM: ❯ Version
9:20:58 AM:   @netlify/build 29.26.4
9:20:58 AM: ​
9:20:58 AM: ❯ Flags
9:20:58 AM:   baseRelDir: true
9:20:58 AM:   buildId: 6555d0cb6c2759565fec5bca
9:20:58 AM:   deployId: 6555d0cb6c2759565fec5bcc
9:20:58 AM: ​
9:20:58 AM: ❯ Current directory
9:20:58 AM:   /opt/build/repo
9:20:58 AM: ​
9:20:58 AM: ❯ Config file
9:20:58 AM:   No config file was defined: using default values.
9:20:58 AM: ​
9:20:58 AM: ❯ Context
9:20:58 AM:   production
9:20:58 AM: ​
9:20:58 AM: ❯ Installing plugins
9:20:58 AM:    - @netlify/plugin-nextjs@4.41.1
9:21:07 AM: ​
9:21:07 AM: ❯ Using Next.js Runtime - v4.41.1
9:21:08 AM: ​
9:21:08 AM: @netlify/plugin-nextjs (onPreBuild event)                     
9:21:08 AM: ────────────────────────────────────────────────────────────────
9:21:08 AM: ​
9:21:08 AM: No Next.js cache to restore.
9:21:08 AM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
9:21:09 AM: ​
9:21:09 AM: (@netlify/plugin-nextjs onPreBuild completed in 53ms)
9:21:09 AM: ​
9:21:09 AM: Build command from Netlify app                                
9:21:09 AM: ────────────────────────────────────────────────────────────────
9:21:09 AM: ​
9:21:09 AM: $ npm run build
9:21:09 AM: > tmp-cpa@0.1.0 build
9:21:09 AM: > next build
9:21:09 AM: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
9:21:09 AM:    Linting and checking validity of types ...
9:21:10 AM:    β–² Next.js 14.0.2
9:21:10 AM:    Creating an optimized production build ...
9:21:13 AM:  βœ“ Compiled successfully
9:21:13 AM:    Collecting page data ...
9:21:13 AM: Plasmic: doing a fresh fetch...
9:21:14 AM: Plasmic: fetched designs for "lottie-react" (5dGW8Awro3qq8Hh5MveXLP@1.21.0), "plasmic-nav" (7nJ7UcFmq9UzB6eXfC5z4a@0.24.0), "plasmic-query" (YUiM7yqBWAqsh8KSnrdj7@0.24.0), "plasmic-basic-components" (caTPwKxj5ZrD9LQ7DMdK4Z@3.32.0), "react-parallax-tilt" (szjgMQpPpxhmkjnaBvZQJG@2.21.0), "Lengershaus" (vnMgaQhRPZQgVFconhiafP@10.0.1)
9:21:15 AM:    Generating static pages (0/7) ...
9:21:15 AM:    Generating static pages (1/7)
9:21:15 AM: Plasmic: doing a fresh fetch...
9:21:15 AM: Plasmic: doing a fresh fetch...
9:21:15 AM: Plasmic: doing a fresh fetch...
9:21:15 AM:    Generating static pages (3/7)
9:21:15 AM: Plasmic: doing a fresh fetch...
9:21:15 AM: Plasmic: fetched designs for "lottie-react" (5dGW8Awro3qq8Hh5MveXLP@1.21.0), "plasmic-nav" (7nJ7UcFmq9UzB6eXfC5z4a@0.24.0), "plasmic-query" (YUiM7yqBWAqsh8KSnrdj7@0.24.0), "plasmic-basic-components" (caTPwKxj5ZrD9LQ7DMdK4Z@3.32.0), "react-parallax-tilt" (szjgMQpPpxhmkjnaBvZQJG@2.21.0), "Lengershaus" (vnMgaQhRPZQgVFconhiafP@10.0.1)
9:21:15 AM: Plasmic: fetched designs for "lottie-react" (5dGW8Awro3qq8Hh5MveXLP@1.21.0), "plasmic-nav" (7nJ7UcFmq9UzB6eXfC5z4a@0.24.0), "plasmic-query" (YUiM7yqBWAqsh8KSnrdj7@0.24.0), "plasmic-basic-components" (caTPwKxj5ZrD9LQ7DMdK4Z@3.32.0), "react-parallax-tilt" (szjgMQpPpxhmkjnaBvZQJG@2.21.0), "Lengershaus" (vnMgaQhRPZQgVFconhiafP@10.0.1)
9:21:15 AM: Plasmic: fetched designs for "lottie-react" (5dGW8Awro3qq8Hh5MveXLP@1.21.0), "plasmic-nav" (7nJ7UcFmq9UzB6eXfC5z4a@0.24.0), "plasmic-query" (YUiM7yqBWAqsh8KSnrdj7@0.24.0), "plasmic-basic-components" (caTPwKxj5ZrD9LQ7DMdK4Z@3.32.0), "react-parallax-tilt" (szjgMQpPpxhmkjnaBvZQJG@2.21.0), "Lengershaus" (vnMgaQhRPZQgVFconhiafP@10.0.1)
9:21:15 AM: In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.
9:21:15 AM: In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.
9:21:15 AM: In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.
9:21:15 AM: Plasmic: fetched designs for "lottie-react" (5dGW8Awro3qq8Hh5MveXLP@1.21.0), "plasmic-nav" (7nJ7UcFmq9UzB6eXfC5z4a@0.24.0), "plasmic-query" (YUiM7yqBWAqsh8KSnrdj7@0.24.0), "plasmic-basic-components" (caTPwKxj5ZrD9LQ7DMdK4Z@3.32.0), "react-parallax-tilt" (szjgMQpPpxhmkjnaBvZQJG@2.21.0), "Lengershaus" (vnMgaQhRPZQgVFconhiafP@10.0.1)
9:21:15 AM: Warning: data for page "/[[...catchall]]" (path "/") is 389 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
9:21:15 AM: See more info here: https://nextjs.org/docs/messages/large-page-data
9:21:15 AM: In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.
9:21:16 AM: Warning: data for page "/[[...catchall]]" (path "/exhibitions") is 205 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
9:21:16 AM: See more info here: https://nextjs.org/docs/messages/large-page-data
9:21:16 AM:    Generating static pages (5/7)
9:21:16 AM: Warning: data for page "/[[...catchall]]" (path "/home") is 216 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
9:21:16 AM: See more info here: https://nextjs.org/docs/messages/large-page-data
9:21:16 AM: Warning: data for page "/[[...catchall]]" (path "/shop") is 173 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
9:21:16 AM: See more info here: https://nextjs.org/docs/messages/large-page-data
9:21:16 AM:  βœ“ Generating static pages (7/7)
9:21:18 AM:    Finalizing page optimization ...
9:21:18 AM:    Collecting build traces ...
9:21:20 AM: Route (pages)                                     Size     First Load JS
9:21:20 AM: β”Œ ● /[[...catchall]] (ISR: 60 Seconds) (4897 ms)  653 B           128 kB
9:21:20 AM: β”œ   β”œ /shop (1524 ms)
9:21:20 AM: β”œ   β”œ /home (1440 ms)
9:21:20 AM: β”œ   β”œ /exhibitions (1404 ms)
9:21:20 AM: β”œ   β”” / (529 ms)
9:21:20 AM: β”œ β—‹ /404                                          182 B          99.9 kB
9:21:20 AM: β”œ Ξ» /api/hello                                    0 B            99.7 kB
9:21:20 AM: β”” β—‹ /plasmic-host                                 440 B           128 kB
9:21:20 AM: + First Load JS shared by all                     99.7 kB
9:21:20 AM:   β”œ chunks/framework-4e70414653b0876d.js          66.8 kB
9:21:20 AM:   β”œ chunks/main-e2d2905bced8715f.js               31.7 kB
9:21:20 AM:   β”œ chunks/pages/_app-4b2a93ae7e555bdc.js         195 B
9:21:20 AM:   β”” chunks/webpack-6ef43a8d4a395f49.js            999 B
9:21:20 AM: β—‹  (Static)   prerendered as static content
9:21:20 AM: ●  (SSG)      prerendered as static HTML (uses getStaticProps)
9:21:20 AM:    (ISR)      incremental static regeneration (uses revalidate in getStaticProps)
9:21:20 AM: Ξ»  (Dynamic)  server-rendered on demand using Node.js
9:21:20 AM: ​
9:21:20 AM: (build.command completed in 11.6s)
9:21:20 AM: ​
9:21:20 AM: @netlify/plugin-nextjs (onBuild event)                        
9:21:20 AM: ────────────────────────────────────────────────────────────────
9:21:20 AM: ​
9:21:20 AM: Moving static page files to serve from CDN...
9:21:20 AM: Moved 3 files to CDN
9:21:20 AM: You are not using Netlify Edge Functions for image format detection. Set env var "NEXT_FORCE_EDGE_IMAGES=true" to enable.
9:21:20 AM: Netlify configuration property "redirects" value changed to [
9:21:20 AM:   { from: "/_next/static/*", to: "/static/:splat", status: 200 },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/image*",
9:21:20 AM:     query: { url: ":url", w: ":width", q: ":quality" },
9:21:20 AM:     to: "/_ipx/w_:width,q_:quality/:url",
9:21:20 AM:     status: 301
9:21:20 AM:   },
9:21:20 AM:   { from: "/_ipx/*", to: "/.netlify/builders/_ipx", status: 200 },
9:21:20 AM:   {
9:21:20 AM:     from: "/api/*",
9:21:20 AM:     to: "/.netlify/functions/___netlify-handler",
9:21:20 AM:     status: 200
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/favicon.ico",
9:21:20 AM:     to: "/favicon.ico",
9:21:20 AM:     conditions: { Cookie: [Array] },
9:21:20 AM:     status: 200
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/next.svg",
9:21:20 AM:     to: "/next.svg",
9:21:20 AM:     conditions: { Cookie: [Array] },
9:21:20 AM:     status: 200
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/vercel.svg",
9:21:20 AM:     to: "/vercel.svg",
9:21:20 AM:     conditions: { Cookie: [Array] },
9:21:20 AM:     status: 200
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/*",
9:21:20 AM:     to: "/.netlify/functions/___netlify-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     conditions: { Cookie: [Array] },
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/index.json",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/home.json",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/home",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/exhibitions.json",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/exhibitions",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/shop.json",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/shop",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: true
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/plasmic-host.json",
9:21:20 AM:     to: "/.netlify/functions/___netlify-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: false
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/plasmic-host",
9:21:20 AM:     to: "/.netlify/functions/___netlify-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: false
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/index.json",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: false
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/_next/data/c4OzuMwCUdc3PQQ2n240L/*",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: false
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: false
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/*",
9:21:20 AM:     to: "/.netlify/builders/___netlify-odb-handler",
9:21:20 AM:     status: 200,
9:21:20 AM:     force: false
9:21:20 AM:   },
9:21:20 AM:   {
9:21:20 AM:     from: "/*",
9:21:20 AM:     to: "/.netlify/functions/___netlify-handler",
9:21:20 AM:     status: 200
9:21:20 AM:   }
9:21:20 AM: ].
9:21:20 AM: ​
9:21:20 AM: (@netlify/plugin-nextjs onBuild completed in 151ms)
9:21:20 AM: ​
9:21:20 AM: Functions bundling                                            
9:21:20 AM: ────────────────────────────────────────────────────────────────
9:21:20 AM: ​
9:21:20 AM: Packaging Functions from .netlify/functions-internal directory:
9:21:20 AM:  - ___netlify-handler/___netlify-handler.js
9:21:20 AM:  - ___netlify-odb-handler/___netlify-odb-handler.js
9:21:20 AM:  - _ipx/_ipx.js
9:21:20 AM: ​
9:21:37 AM: ​
9:21:37 AM: (Functions bundling completed in 16.5s)
9:21:37 AM: ​
9:21:37 AM: Edge Functions bundling                                       
9:21:37 AM: ────────────────────────────────────────────────────────────────
9:21:37 AM: ​
9:21:38 AM: ​
9:21:38 AM: (Edge Functions bundling completed in 836ms)
9:21:38 AM: ​
9:21:38 AM: @netlify/plugin-nextjs (onPostBuild event)                    
9:21:38 AM: ────────────────────────────────────────────────────────────────
9:21:38 AM: ​
9:21:38 AM: Next.js cache saved.
9:21:38 AM: ​
9:21:38 AM: (@netlify/plugin-nextjs onPostBuild completed in 54ms)
9:21:38 AM: ​
9:21:38 AM: Deploy site                                                   
9:21:38 AM: ────────────────────────────────────────────────────────────────
9:21:38 AM: ​
9:21:38 AM: Starting to deploy site from ".next"
9:21:38 AM: Calculating files to upload
9:21:38 AM: 4 new files to upload
9:21:38 AM: 2 new functions to upload
9:21:47 AM: Post processing done
9:21:47 AM: Section completed: postprocessing
9:21:47 AM: Site is live ✨
9:21:47 AM: Starting post processing
9:21:47 AM: Skipping form detection
9:21:47 AM: Post processing - header rules
9:21:47 AM: Post processing - redirect rules
9:21:47 AM: Section completed: deploying
9:21:47 AM: Site deploy was successfully initiated
9:21:47 AM: ​
9:21:47 AM: (Deploy site completed in 8.8s)
9:21:47 AM: ​
9:21:47 AM: Netlify Build Complete                                        
9:21:47 AM: ────────────────────────────────────────────────────────────────
9:21:47 AM: ​
9:21:47 AM: (Netlify Build completed in 48.6s)
9:21:48 AM: Caching artifacts
9:21:48 AM: Started saving node modules
9:21:48 AM: Finished saving node modules
9:21:48 AM: Started saving build plugins
9:21:48 AM: Finished saving build plugins
9:21:48 AM: Started saving corepack cache
9:21:48 AM: Finished saving corepack cache
9:21:48 AM: Started saving pip cache
9:21:48 AM: Finished saving pip cache
9:21:48 AM: Started saving emacs cask dependencies
9:21:48 AM: Finished saving emacs cask dependencies
9:21:48 AM: Started saving maven dependencies
9:21:48 AM: Finished saving maven dependencies
9:21:48 AM: Started saving boot dependencies
9:21:48 AM: Finished saving boot dependencies
9:21:48 AM: Started saving rust rustup cache
9:21:48 AM: Finished saving rust rustup cache
9:21:48 AM: Started saving go dependencies
9:21:48 AM: Finished saving go dependencies
9:21:49 AM: Build script success
9:21:49 AM: Section completed: building
9:21:50 AM: Uploading Cache of size 181.2MB
9:21:52 AM: Section completed: cleanup
9:21:52 AM: Finished processing build request in 1m8.521s

This is the issue: [Bug]: Error: Cannot find module 'next/dist/server/future/route-modules/pages/vendored/contexts/amp-context' in NextJS preview mode Β· Issue #2329 Β· netlify/next-runtime (github.com)

1 Like

Thank you very much!! It seems to be the same Bug – the workaround was successful: I changed the next-version in package.json to a lower version of β€œnext”: β€œ13.4.8” and now it works.

Glad you found your solution!