Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: middleware-manifest.json not found #1267

Closed
2 tasks
hrishikesh-k opened this issue Mar 17, 2022 · 7 comments
Closed
2 tasks

[Bug]: middleware-manifest.json not found #1267

hrishikesh-k opened this issue Mar 17, 2022 · 7 comments
Labels
priority: medium support_escalation type: bug code to address defects in shipped code

Comments

@hrishikesh-k
Copy link
Contributor

Summary

It appears that for a site that's not using Middlewares at all, we're still looking for a middleware-manifest.json file and this is causing errors to load the site altogether.

A user reported this on the forums: https://answers.netlify.com/t/53484

As per our sync yesterday, we're still not sure about the exact cause of this issue, so this might need some further investigation.

Steps to reproduce

Try visiting their website here: https://naughty-varahamihira-fcffe0.netlify.app/

A link to a reproduction repository

https://github.com/GabZanMacaw/napoleontest

Plugin version

4.2.7

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?

No response

Your netlify.toml file

None in repo

Your public/_redirects file

None in repo

Your next.config.js file

`next.config.js`
const withPWA = require("next-pwa");

module.exports = withPWA({
  pwa: {
    dest: "public",
  },
  images: {
    //domains: ["localhost"],
    domains: ["res.cloudinary.com"],
  },
});

// module.exports = {
//   images: {
//     domains: ['res.cloudinary.com'],
//   },
// }

Builds logs (or link to your logs)

https://app.netlify.com/sites/naughty-varahamihira-fcffe0/deploys/6230a45e1f405520c81e1d71

Function logs

Function logs
{
  "errorType": "Error",
  "errorMessage": "Cannot find module '/var/task/.next/server/middleware-manifest.json'\nRequire stack:\n- /var/task/node_modules/next/dist/server/next-server.js\n- /var/task/.netlify/functions-internal/___netlify-odb-handler/handlerUtils.js\n- /var/task/.netlify/functions-internal/___netlify-odb-handler/___netlify-odb-handler.js\n- /var/task/___netlify-odb-handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
  "trace": [
    "Error: Cannot find module '/var/task/.next/server/middleware-manifest.json'",
    "Require stack:",
    "- /var/task/node_modules/next/dist/server/next-server.js",
    "- /var/task/.netlify/functions-internal/___netlify-odb-handler/handlerUtils.js",
    "- /var/task/.netlify/functions-internal/___netlify-odb-handler/___netlify-odb-handler.js",
    "- /var/task/___netlify-odb-handler.js",
    "- /var/runtime/UserFunction.js",
    "- /var/runtime/index.js",
    "    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:746:27)",
    "    at Module.require (internal/modules/cjs/loader.js:974:19)",
    "    at require (internal/modules/cjs/helpers.js:93:18)",
    "    at NextNodeServer.getMiddlewareManifest (/var/task/node_modules/next/dist/server/next-server.js:600:20)",
    "    at new Server (/var/task/node_modules/next/dist/server/base-server.js:128:40)",
    "    at new NextNodeServer (/var/task/node_modules/next/dist/server/next-server.js:74:9)",
    "    at getBridge (/var/task/.netlify/functions-internal/___netlify-odb-handler/___netlify-odb-handler.js:46:28)",
    "    at handler (/var/task/.netlify/functions-internal/___netlify-odb-handler/___netlify-odb-handler.js:75:46)",
    "    at Runtime.handler (/var/task/node_modules/@netlify/functions/dist/lib/builder.js:41:25)"
  ]
}

.next JSON files

No response

@hrishikesh-k hrishikesh-k added type: bug code to address defects in shipped code support_escalation labels Mar 17, 2022
@GabZanMacaw
Copy link

OP here, thank you for the continued support! The OS is Windows 11. I'll also confirm that no files are missing from the repo, and adding back the .next folder didn't fix the issue.

@RyanTinka
Copy link

+1

@priyansharma
Copy link

Please Help, I also get this same issue and I try many way to solve it but nothing is happening
issueGit from 2022-07-12 10-47-07

@orinokai
Copy link
Contributor

orinokai commented Feb 6, 2023

Closing as resolved, as per the forum post. This was due to an incompatibility between Next 11 and an older version of the runtime, which I believe is resolved with later versions because we have no recent reports.

@orinokai orinokai closed this as completed Feb 6, 2023
@rogofan
Copy link

rogofan commented Jun 9, 2023

Just stop terminal (ctrl + c) and in explorer right click on .next folder and delete it. After that run program again. Next build again with new middleware-manifest.json. For me it works fine :)

@felipenobrg
Copy link

Just stop terminal (ctrl + c) and in explorer right click on .next folder and delete it. After that run program again. Next build again with new middleware-manifest.json. For me it works fine :)

Thank you, help a lot

@BirkhoffLee
Copy link

Still an issue in next@14.2.0-canary.48:

 GET /product/example 500 in 7ms
 ⨯ Error: Cannot find module 'project/.next/server/middleware-manifest.json'
Require stack:
- project/node_modules/next/dist/server/next-server.js
- project/node_modules/next/dist/server/dev/next-dev-server.js
- project/node_modules/next/dist/server/next.js
- project/node_modules/next/dist/server/lib/start-server.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at project/node_modules/next/dist/server/require-hook.js:55:36
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (project/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:130:18)
    at DevServer.getMiddlewareManifest (project/node_modules/next/dist/server/next-server.js:907:26)
    at DevServer.getEdgeFunctionsPages (project/node_modules/next/dist/server/next-server.js:923:31)
    at DevServer.renderErrorToResponseImpl (project/node_modules/next/dist/server/next-server.js:882:22)
    at async DevServer.pipeImpl (project/node_modules/next/dist/server/base-server.js:911:25)
    at async NextNodeServer.handleCatchallRenderRequest (project/node_modules/next/dist/server/next-server.js:231:21)
    at async DevServer.handleRequestImpl (project/node_modules/next/dist/server/base-server.js:807:17)
    at async project/node_modules/next/dist/server/dev/next-dev-server.js:339:20
    at async Span.traceAsyncFn (project/node_modules/next/dist/trace/trace.js:154:20)
    at async DevServer.handleRequest (project/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
    at async invokeRender (project/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async handleRequest (project/node_modules/next/dist/server/lib/router-server.js:353:24)
    at async requestHandlerImpl (project/node_modules/next/dist/server/lib/router-server.js:377:13)
    at async Server.requestListener (project/node_modules/next/dist/server/lib/start-server.js:141:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'project/node_modules/next/dist/server/next-server.js',
    'project/node_modules/next/dist/server/dev/next-dev-server.js',
    'project/node_modules/next/dist/server/next.js',
    'project/node_modules/next/dist/server/lib/start-server.js'
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium support_escalation type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

8 participants