Hi all,
I've been trying to move the prisma graphql-auth example to work with serverless functions. While I thought this was going to be easy I'm now stuck on a bug that I cannot make sense of.
The only changes to the repository are to src/server.ts to use GraphQLServerLambda rather than GraphQLServer as well as installing netlify-lambda to test my deployments.
Unfortunately that's exactly where it goes wrong. As soon as I start my local lambda server and go to the endpoint, my API crashes with the error:
ERROR: When nexus-plugin-prisma is used as a Nexus Schema plugin, @nexus/schema must be installed as a dependency. Please run `npm install @nexus/schema`.
@nexus/schema as you can see from package.json is already installed as a dependency, so I'm kind of lost.
I created a repository that reproduces the issue, you can find it here.
Steps to reproduce:
npm installnpm run buildnpm run start:lambdaI'm fairly new with graphql so I this may be caused by me misunderstanding something, either way any help would be greatly appreciated as I'm completely stuck at the moment.
Having the same issue over here. In my case I'm trying to deploy Nexus Schema + Apollo Server as an AWS Lambda with the Serverless framework.
I bundle everything up with ncc, then ship the output of that to AWS, but when invoking the Lambda I get the same issue as you @creativiii - @nexus/schema must be installed as a dependency.
Really strange because I can guarantee you @nexus/schema is installed haha, and running my Serverless function offline works fine too 🤷
Same issue here with a graphql-yoga hosted on a lambda only when adding nexus-plugin-prisma.
Looking forward for any more help :)
My issue was that I wasn't including node_modules in my Lambda bundle, not sure if that's applicable to you folks but it worked for me!
My issue was that I wasn't including node_modules in my Lambda bundle, not sure if that's applicable to you folks but it worked for me!
How did you specify you wanted node_modules included? I'll try this later and see if it works 👀
I'm using the Serverless framework, and I had exclude: ["**"] in my serverless.yaml file, along with include: [".build"] on the package property. This basically meant "only include the .build directory in the Lambda zip". This used to work with the nexus framework but not anymore with manually building @nexus/schema.
So I just got rid of the package include/exclude properties in serverless.yaml and let the serverless framework handle the packaging for me, which bundles in node_modules by default (I think) 👍
@creativiii @ben-walker facing same issue when building application for production.
works good in development mode but when i run node dist/app/main.js after building
it throws error
ERROR: @nexus/schema must be installed as a dependency. Please run npm install @nexus/schema
and it's already installed.
It's already present in package.json and node_modules, right now m scratching my head on what's going on.
I have the same problem but even in dev env, by doing npm i graphql, I don't have the error anymore. But I don't think it's the correct solution as there is already a dependency to graphql from nexus-plugin-prisma
Any chance we could get an official word on this? @jasonkuhrt @tgriesser @Weakky ?
Even just a can/can't be done would be great!
So far the workaround I've applied is marking nexus/schema, graphql, prisma/client as external dependency and installing them explicitly in dist by copying package.json with these specific modules. I know it's a tedious solution but sadly I don't think I have any other option.
Hey @creativiii, this sounds like a bug that should be fixed
Hey @creativiii, this sounds like a bug that should be fixed
Do you have any idea what it could be caused by? I'm gonna have a go at fixing it but I'm really unfamiliar with the codebase
I have the same problem when build by webpack.
ensureDepIsInstalled is checking nexus-plugin-prisma package.json, not my project package.json.
Looks like the problem is only marginally related to the file posted by Jason. Even after removing those checks I get the following:
Error during invocation: Error: Failed to import prisma client package at @prisma/client. The following error occured while trying:
Error: Cannot find module '@prisma/client'
at n (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:164972)
at Object.t.getPrismaClientDmmf (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:981:62493)
at Object.t.getTransformedDmmf (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:981:63615)
at new C (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:155986)
at Object.t.build (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:154911)
at Object.onInstall (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1033:20130)
at /home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:53946
at Array.forEach (<anonymous>)
at T.beforeWalkTypes (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:53803)
at T.getFinalTypeMap (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:55375)
at k (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:66023)
at Module.A (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:66606)
at Object.<anonymous> (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1033:15244)
at Object.<anonymous> (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1033:15502)
at n (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1:158)
at Object.<anonymous> (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1218:126566)
at Object.t.getPrismaClientDmmf (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:981:62517)
at Object.t.getTransformedDmmf (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:981:63615)
at new C (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:155986)
at Object.t.build (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:154911)
at Object.onInstall (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1033:20130)
at /home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:53946
at Array.forEach (<anonymous>)
at T.beforeWalkTypes (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:53803)
at T.getFinalTypeMap (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:55375)
at k (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:66023)
at Module.A (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:763:66606)
at Object.<anonymous> (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1033:15244)
at Object.<anonymous> (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1033:15502)
at n (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1:158)
at Object.<anonymous> (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1218:126566)
at n (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1:158)
So that's me out of ideas 🤷♂️
Any news on this issue, currently being affected by it as well. I'm trying out the different fixes mentioned in this thread and will update on what works/doesn't work. We're using serverless as well.
There is no fix, only fix would be fixing it at the library level, but as far as I've seen it doesn't seem something just "anyone" could fix.
@jasonkuhrt @Weakky, Any thoughts on fixing this issue? It's keeping us from updating out of version 2 beta :/
Upgrade to the latest Nexus Prisma plugin. This issue stems from older versions when there was Nexus Framework.
This is still not fixed unless I'm missing something. I updated the reproduction git. To reproduce:
npm installnpm run buildnpm run build:lambdanpm run start:lambdaI don't see the error
❯ yarn start:lambda
yarn run v1.22.10
$ netlify-lambda serve dist/server
netlify-lambda: Starting server
Hash: 5a1ce7ddf2c122b48cf6
Version: webpack 4.44.2
Time: 2793ms
Built at: 2020-11-25 11:45:25 a.m.
Asset Size Chunks Chunk Names
index.js 3.29 MiB 0 [emitted] index
Entrypoint index = index.js
[2] external "path" 42 bytes {0} [built]
[4] external "fs" 42 bytes {0} [built]
[8] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/index.mjs + 4 modules 22.4 KiB {0} [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/index.mjs 7.42 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/version.mjs 426 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/graphql.mjs 4.81 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/subscription/subscribe.mjs 7.17 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/subscription/mapAsyncIterator.mjs 2.19 KiB [built]
[54] external "http" 42 bytes {0} [built]
[65] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js + 45 modules 225 KiB {0} [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js 1.5 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/interfaceType.js 1.37 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/objectType.js 1.3 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/unionType.js 1.14 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/blocks.js 330 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/decorateType.js 293 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/utils.js 17 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/args.js 1.29 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/list.js 757 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/nonNull.js 993 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/nullable.js 956 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/plugin.js 4.42 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/dynamicMethod.js 1.33 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/plugins/index.js 900 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/builder.js 53.2 KiB [built]
| + 31 hidden modules
[101] external "https" 42 bytes {0} [built]
[120] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-tools/dist/index.js 459 bytes {0} [built]
[156] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-middleware/dist/index.js 595 bytes {0} [built]
[160] ../utils.js 506 bytes {0} [built]
[230] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-import/dist/index.js 11 KiB {0} [built]
[289] ../context.js 644 bytes {0} [built]
[325] ./index.js 462 bytes {0} [built]
[326] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js 20.7 KiB {0} [built]
[484] ../permissions/index.js 4.1 KiB {0} [built]
[506] ../schema.js 626 bytes {0} [built]
+ 576 hidden modules
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenAutoConfig.js 70:31-38
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/index.js 30:8-24
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/schema.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/utils.js 386:12-41
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js 73279:20-36
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/.prisma/client/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/index.js
@ ../context.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/application.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/express.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenAutoConfig.js 194:8-36
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/dmmf/utils.js 7:15-35
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/dmmf/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/builder.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/plugin.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/schema.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/buffer-util.js
Module not found: Error: Can't resolve 'bufferutil' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/buffer-util.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/receiver.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/websocket.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/server.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js
Module not found: Error: Can't resolve 'encoding' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/.prisma/client/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/index.js
@ ../context.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenFormatPrettier.js
Module not found: Error: Can't resolve 'prettier' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenFormatPrettier.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/validation.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/sender.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/websocket.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/server.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
Lambda server is listening on 9000
Simplified the repro git by a bunch.
I also did a full reset of node_modules and package-lock. The error is still there, it happens when you visit http://localhost:9000/.netlify/functions/index.
I'm using npm, is that why?
We just managed to fix the issue on our end, turns out we were adding nexus-plugin-prisma to externals configuration in webpack, but were importing from 'nexus-plugin-prisma/schema'. We changed externals to 'nexus-plugin-prisma/schema' instead and now everything is bundled correctly.
We also noticed it worked if only importing from 'nexus-plugin-prisma' with the original externals config.
@jasonkuhrt if this can help in reproducing the issue we found, try adding nexus-plugin-prisma to your webpack externals, then import from 'nexus-plugin-prisma/schema'. You'll notice the exact issue mentioned here. My guess is that /schema isn't properly bundled right now.
I'd like to petition for this to be re-opened if at all possible?
Still not able to reproduce with your latest changes:
❯ npm run start:lambda
> graphql-auth@ start:lambda /Users/jasonkuhrt/nexus-prisma-bug
> netlify-lambda serve dist/server
netlify-lambda: Starting server
Hash: 3e6572a49b95fbcdd2cc
Version: webpack 4.44.2
Time: 2680ms
Built at: 2020-11-26 12:11:49 p.m.
Asset Size Chunks Chunk Names
index.js 3.15 MiB 0 [emitted] index
Entrypoint index = index.js
[2] external "path" 42 bytes {0} [built]
[4] external "fs" 42 bytes {0} [built]
[8] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/index.mjs + 4 modules 22.4 KiB {0} [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/index.mjs 7.42 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/version.mjs 426 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/graphql.mjs 4.81 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/subscription/subscribe.mjs 7.17 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql/subscription/mapAsyncIterator.mjs 2.19 KiB [built]
[53] external "http" 42 bytes {0} [built]
[78] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js + 45 modules 225 KiB {0} [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js 1.5 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/interfaceType.js 1.37 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/objectType.js 1.3 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/unionType.js 1.14 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/blocks.js 330 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/decorateType.js 293 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/utils.js 17 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/args.js 1.29 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/list.js 757 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/nonNull.js 993 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/nullable.js 956 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/plugin.js 4.42 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/dynamicMethod.js 1.33 KiB [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/plugins/index.js 900 bytes [built]
| /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/builder.js 53.2 KiB [built]
| + 31 hidden modules
[94] external "https" 42 bytes {0} [built]
[112] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-tools/dist/index.js 459 bytes {0} [built]
[217] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-import/dist/index.js 11 KiB {0} [built]
[219] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-deduplicator/dist/index.js 578 bytes {0} [built]
[237] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-middleware/dist/index.js 595 bytes {0} [built]
[266] ../context.js 644 bytes {0} [built]
[299] ./index.js 643 bytes {0} [built]
[300] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js 20.7 KiB {0} [built]
[301] /Users/jasonkuhrt/nexus-prisma-bug/node_modules/apollo-server-express/dist/index.js 442 bytes {0} [built]
[463] ../schema.js 626 bytes {0} [built]
+ 527 hidden modules
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenAutoConfig.js 70:31-38
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/index.js 30:8-24
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/schema.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/utils.js 386:12-41
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js 73279:20-36
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/.prisma/client/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/index.js
@ ../context.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/application.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/express.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenAutoConfig.js 194:8-36
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/dmmf/utils.js 7:15-35
Critical dependency: the request of a dependency is an expression
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/dmmf/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/builder.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/plugin.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/nexus-plugin-prisma/schema.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/buffer-util.js
Module not found: Error: Can't resolve 'bufferutil' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/buffer-util.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/sender.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/server.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js
Module not found: Error: Can't resolve 'encoding' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/.prisma/client/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@prisma/client/index.js
@ ../context.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenFormatPrettier.js
Module not found: Error: Can't resolve 'prettier' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenFormatPrettier.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib'
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/validation.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/lib/sender.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/ws/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/server.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/index.js
@ /Users/jasonkuhrt/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
Lambda server is listening on 9000
Request from ::1: GET /.netlify/functions/server
Response with status 500 in 1 ms.
Error during invocation: Error: Cannot find module '/Users/jasonkuhrt/nexus-prisma-bug/built-lambda/server'
Require stack:
- /Users/jasonkuhrt/nexus-prisma-bug/node_modules/netlify-lambda/lib/serve.js
- /Users/jasonkuhrt/nexus-prisma-bug/node_modules/netlify-lambda/bin/cmd.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at /Users/jasonkuhrt/nexus-prisma-bug/node_modules/netlify-lambda/lib/serve.js:122:17
at Layer.handle [as handle_request] (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:137:13)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:131:14)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:131:14)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:131:14)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:131:14)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:131:14)
at next (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:131:14)
at Route.dispatch (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/layer.js:95:5)
at /Users/jasonkuhrt/nexus-prisma-bug/node_modules/express/lib/router/index.js:281:22 {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/jasonkuhrt/nexus-prisma-bug/node_modules/netlify-lambda/lib/serve.js',
'/Users/jasonkuhrt/nexus-prisma-bug/node_modules/netlify-lambda/bin/cmd.js'
]
}
Looking at your stack trace, this is not an NPP error:
Error during invocation: Error: Failed to import prisma client package at @prisma/client. The following error occured while trying:
Error: Cannot find module '@prisma/client'
at n (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:164972)
Looking at your stack trace, this is not an NPP error:
Error during invocation: Error: Failed to import prisma client package at @prisma/client. The following error occured while trying: Error: Cannot find module '@prisma/client' at n (/home/leonardo/nexus-prisma-bug/built-lambda/server.js:1094:164972)
This was after gutting nexus-plugin-prisma, the following is my actual stack trace.
yarn start:lambda
yarn run v1.22.5
$ netlify-lambda serve dist/server
netlify-lambda: Starting server
Hash: 420116d7852e63f5ef30
Version: webpack 4.44.2
Time: 3077ms
Built at: 26/11/2020 17:52:35
Asset Size Chunks Chunk Names
index.js 3.15 MiB 0 [emitted] index
Entrypoint index = index.js
[2] external "path" 42 bytes {0} [built]
[4] external "fs" 42 bytes {0} [built]
[8] /home/leonardo/nexus-prisma-bug/node_modules/graphql/index.mjs + 4 modules 22.4 KiB {0} [built]
| /home/leonardo/nexus-prisma-bug/node_modules/graphql/index.mjs 7.42 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/graphql/version.mjs 426 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/graphql/graphql.mjs 4.81 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/graphql/subscription/subscribe.mjs 7.17 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/graphql/subscription/mapAsyncIterator.mjs 2.19 KiB [built]
[53] external "http" 42 bytes {0} [built]
[78] /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js + 45 modules 225 KiB {0} [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js 1.5 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/interfaceType.js 1.37 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/objectType.js 1.3 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/unionType.js 1.14 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/blocks.js 330 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/decorateType.js 293 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/utils.js 17 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/args.js 1.29 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/list.js 757 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/nonNull.js 993 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/definitions/nullable.js 956 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/plugin.js 4.42 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/dynamicMethod.js 1.33 KiB [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/plugins/index.js 900 bytes [built]
| /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/builder.js 53.2 KiB [built]
| + 31 hidden modules
[94] external "https" 42 bytes {0} [built]
[112] /home/leonardo/nexus-prisma-bug/node_modules/graphql-tools/dist/index.js 459 bytes {0} [built]
[217] /home/leonardo/nexus-prisma-bug/node_modules/graphql-import/dist/index.js 11 KiB {0} [built]
[219] /home/leonardo/nexus-prisma-bug/node_modules/graphql-deduplicator/dist/index.js 578 bytes {0} [built]
[237] /home/leonardo/nexus-prisma-bug/node_modules/graphql-middleware/dist/index.js 595 bytes {0} [built]
[266] ../context.js 644 bytes {0} [built]
[299] ./index.js 643 bytes {0} [built]
[300] /home/leonardo/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js 20.7 KiB {0} [built]
[301] /home/leonardo/nexus-prisma-bug/node_modules/apollo-server-express/dist/index.js 442 bytes {0} [built]
[463] ../schema.js 626 bytes {0} [built]
+ 527 hidden modules
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenAutoConfig.js 70:31-38
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/index.js 30:8-24
Critical dependency: the request of a dependency is an expression
@ /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/schema.js
@ ../schema.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/utils.js 386:12-41
Critical dependency: the request of a dependency is an expression
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js 73279:20-36
Critical dependency: the request of a dependency is an expression
@ /home/leonardo/nexus-prisma-bug/node_modules/.prisma/client/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/@prisma/client/index.js
@ ../context.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
@ /home/leonardo/nexus-prisma-bug/node_modules/express/lib/application.js
@ /home/leonardo/nexus-prisma-bug/node_modules/express/lib/express.js
@ /home/leonardo/nexus-prisma-bug/node_modules/express/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenAutoConfig.js 194:8-36
Critical dependency: the request of a dependency is an expression
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/dmmf/utils.js 7:15-35
Critical dependency: the request of a dependency is an expression
@ /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/dmmf/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/builder.js
@ /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/plugin.js
@ /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/dist/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/nexus-plugin-prisma/schema.js
@ ../schema.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/ws/lib/buffer-util.js
Module not found: Error: Can't resolve 'bufferutil' in '/home/leonardo/nexus-prisma-bug/node_modules/ws/lib'
@ /home/leonardo/nexus-prisma-bug/node_modules/ws/lib/buffer-util.js
@ /home/leonardo/nexus-prisma-bug/node_modules/ws/lib/receiver.js
@ /home/leonardo/nexus-prisma-bug/node_modules/ws/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/server.js
@ /home/leonardo/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js
Module not found: Error: Can't resolve 'encoding' in '/home/leonardo/nexus-prisma-bug/node_modules/@prisma/client/runtime'
@ /home/leonardo/nexus-prisma-bug/node_modules/@prisma/client/runtime/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/.prisma/client/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/@prisma/client/index.js
@ ../context.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenFormatPrettier.js
Module not found: Error: Can't resolve 'prettier' in '/home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm'
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/typegenFormatPrettier.js
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/core.js
@ /home/leonardo/nexus-prisma-bug/node_modules/@nexus/schema/dist-esm/index.js
@ ../schema.js
@ ./index.js
WARNING in /home/leonardo/nexus-prisma-bug/node_modules/ws/lib/validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/home/leonardo/nexus-prisma-bug/node_modules/ws/lib'
@ /home/leonardo/nexus-prisma-bug/node_modules/ws/lib/validation.js
@ /home/leonardo/nexus-prisma-bug/node_modules/ws/lib/receiver.js
@ /home/leonardo/nexus-prisma-bug/node_modules/ws/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/server.js
@ /home/leonardo/nexus-prisma-bug/node_modules/subscriptions-transport-ws/dist/index.js
@ /home/leonardo/nexus-prisma-bug/node_modules/graphql-yoga/dist/index.js
@ ./index.js
Lambda server is listening on 9000
Request from ::ffff:127.0.0.1: GET /.netlify/functions/index
ERROR: @nexus/schema must be installed as a dependency. Please run `npm install @nexus/schema`.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Command failed: /home/leonardo/.yvm/versions/v1.22.5/bin/yarn.js start:lambda
I'm really confused, I have absolutely no idea how the error could possibly be different between the two of us.
@prisma/client is also installed obviously.
LOC where that message comes from https://github.com/graphql-nexus/nexus-plugin-prisma/blob/652157dce2a3f504aaf15afc06fd4f6c81f89057/src/index.ts#L14
No idea, maybe @Weakky can repro though. If he can then we can re-open this issue.
@creativiii wow that's strange, same node version etc.?
Little update, your code wasn't failing the same way as mine because you likely visited:
http://localhost:9000/.netlify/functions/server
Or another non-existing route. Any route that doesn't exist won't crash the application but just return a module not found error.
It's my bad for pasting the wrong link. The actual link that crashes the application like in my stack trace is:
localhost:9000/.netlify/functions/index
Very sorry about the confusion.
@creativiii wow that's strange, same node version etc.?
Sorry, actually caught my mistake as soon as I posted that. Check the above post for the actual reason our errors are different.
Edit: I'll be honest I'm starting to think this is related to netlify-lambda more than it is related with nexus-plugin-prisma 🙃
Most helpful comment
This is still not fixed unless I'm missing something. I updated the reproduction git. To reproduce:
npm installnpm run buildnpm run build:lambdanpm run start:lambda