Skip to content

[Bug]: [next-dev] TypeError: Module not found "file:///Users/lukasholzer/Sites/oepolsv/.netlify/middleware.js#0". #1983

Closed
@lukasholzer

Description

@lukasholzer

Summary

When updating to the newest next runtime "@netlify/plugin-nextjs": "^4.32.0", and running ntl dev in my project I get the following console error – with 4.31.0 it's working

❯ ntl dev
◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Injected .env file env var: STORYBLOK_TOKEN
◈ Injected .env file env var: STORYBLOK_PREVIEW_SECRET
◈ Injected .env file env var: IG_APP_ID
◈ Injected .env file env var: IG_SECRET
◈ Setting up local development server
Patching /Users/lukasholzer/Sites/oepolsv/node_modules/.pnpm/next@13.1.6_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/base-server.js
Done
Patching /Users/lukasholzer/Sites/oepolsv/node_modules/.pnpm/next@13.1.6_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/next-server.js
Done
◈ Starting Netlify Dev with Next.js
✔ Waiting for framework port 3000. This can be configured using the 'targetPort' property in the netlify.toml

   ┌──────────────────────────────────────────────────┐
   │                                                  │
   │   ◈ Server now ready on https://localhost:8888   │
   │                                                  │
   └──────────────────────────────────────────────────┘

◈ Loaded edge function netlify dev handler

> oepolsv@0.1.0 dev
> next dev

[next-dev] TypeError: Module not found "file:///Users/lukasholzer/Sites/oepolsv/.netlify/middleware.js#0".
    at async Object.handler [as function] (file:///Users/lukasholzer/Sites/oepolsv/.netlify/edge-functions/next-dev/index.js:38:28)
    at async FunctionChain.runFunction (https://63c7dea30898f20009dd4da8--edge.netlify.app/bootstrap/function_chain.ts:341:24)
    at async FunctionChain.run (https://63c7dea30898f20009dd4da8--edge.netlify.app/bootstrap/function_chain.ts:293:22)
    at async handleRequest (https://63c7dea30898f20009dd4da8--edge.netlify.app/bootstrap/handler.ts:63:22)
    at async Server.#respond (https://deno.land/std@0.170.0/http/server.ts:299:18)
[next-dev] TypeError: Module not found "file:///Users/lukasholzer/Sites/oepolsv/.netlify/middleware.js#1".
    at async Object.handler [as function] (file:///Users/lukasholzer/Sites/oepolsv/.netlify/edge-functions/next-dev/index.js:38:28)
    at async FunctionChain.runFunction (https://63c7dea30898f20009dd4da8--edge.netlify.app/bootstrap/function_chain.ts:341:24)
    at async FunctionChain.run (https://63c7dea30898f20009dd4da8--edge.netlify.app/bootstrap/function_chain.ts:293:22)
    at async handleRequest (https://63c7dea30898f20009dd4da8--edge.netlify.app/bootstrap/handler.ts:63:22)
    at async Server.#respond (https://deno.land/std@0.170.0/http/server.ts:299:18)
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /Users/lukasholzer/Sites/oepolsv/.env
event - compiled client and server successfully in 9.5s (1928 modules)

followed by a UI error:
CleanShot 2023-03-13 at 20 10 51

Steps to reproduce

  1. Go to a nextjs application
  2. update the plugin nextjs inside the package.json to 4.32.0. and install
  3. run ntl dev

A link to a reproduction repository

No response

Next Runtime version

4.32.0

Is your issue related to the app directory (beta)?

  • Yes, I am using the app directory

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Mac OS

Your netlify.toml file

[build]
command = "npm run build"
publish = ".next"

[dev]

[dev.https]
certFile = "localhost.pem"
keyFile = "localhost-key.pem"
port = 8888

Your public/_redirects file

`_redirects`
# Paste content of your `_redirects` file here

Your next.config.js file

`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.

Metadata

Metadata

Assignees

Labels

type: bugcode to address defects in shipped code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions