-
Notifications
You must be signed in to change notification settings - Fork 118
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
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
.
#843
Comments
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 Really strange because I can guarantee you |
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! |
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 So I just got rid of the |
@creativiii @ben-walker facing same issue when building application for production. |
I have the same problem but even in dev env, by doing |
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 |
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. |
Looks like the problem is only marginally related to the file posted by Jason. Even after removing those checks I get the following:
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:
|
I don't see the error
|
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:
|
Looking at your stack trace, this is not an NPP error:
|
This was after gutting
I'm really confused, I have absolutely no idea how the error could possibly be different between the two of us. |
LOC where that message comes from nexus-plugin-prisma/src/index.ts Line 14 in 652157d
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:
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:
Very sorry about the confusion. |
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 🙃 |
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 useGraphQLServerLambda
rather thanGraphQLServer
as well as installingnetlify-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:
@nexus/schema
as you can see frompackage.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 install
npm run build
npm run start:lambda
I'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.
The text was updated successfully, but these errors were encountered: