Broken on Next.js 10.2.0 which uses Webpack 5 when running a custom server to support HTTPS locally
See original GitHub issueBug description
When I upgrade Next.js to 10.2.0 which uses Webpack 5 and then run node server.js
to run my app locally using HTTPS, I get this error:
error - ./prisma/client/runtime/index.js:24474:15
Module not found: Can't resolve '_http_common'
24472 | var require_http_parser = __commonJS2((exports2, module2) => {
24473 | "use strict";
> 24474 | var common = require("_http_common");
| ^
24475 | if (common.HTTPParser) {
24476 | module2.exports = common.HTTPParser;
24477 | } else {
How to reproduce
Typically you run Next.js apps locally by running npm run dev
and thatās it, but if you want to use HTTPS locally then you have to do something a bit different which involves creating a file usually called āserver.jsā which attaches the SSL certificate and then runs the server. I have no idea if this particularly issue is related to that or if it would happen without HTTPS, as I only use this method now. Iām hoping the error message alone might make the issue apparent to anyone who understands what itās saying, and why Webpack 5 would cause this.
Expected behavior
Everything works just as it would on Next.js <10.2.0 / Webpack 4.
Environment & setup
- OS: macOS Big Sur
- Database: MySQL / Amazon Aurora
- Node.js version: 14.16.0
- Prisma version:
prisma : 2.22.0
@prisma/client : 2.22.0
Current platform : darwin
Query Engine : query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine : migration-engine-cli 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : 60cc71d884972ab4e897f0277c4b84383dddaf6c
Studio : 0.379.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:26 (12 by maintainers)
Top GitHub Comments
@gavrichards If it helps I upgraded to nextjs 11.1.0 / webpack 5, prisma 2.30.0 and this next.config.js trick still works with node 14.x:
PS: a full config is here https://github.com/belgattitude/nextjs-monorepo-example/blob/main/apps/web-app/next.config.js#L127
For what itās worth, I simply needed to remove
target: "serverless"
from next.config.js.