-
Notifications
You must be signed in to change notification settings - Fork 287
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
nestJS + graphql code first + ncc = Error: Generating schema error #377
Comments
I have the same issue. Did you manage to get it working somehow? |
@darklam not for the moment, it is not so bad to have a docker image = 943mo :D |
Are you using type-graphql? If you are, @nestjs/graphql uses the nestjs/nest#2213 Might be solved by: #383 |
@aequasi I tried the latest beta and the build still throws the same error. Do you know of any workaround until it is fixed? |
Unfortunately, I do not. I'm hoping that nestjs drops the usage of the |
The optional package is working properly in ncc 0.18.5 @jogelin Can you confirm this is fixed for you? |
@styfle the optional package seems to work I just meet another issue now but I don't know what it is, I'll have to investigate:
Not related to ncc |
@styfle forget my previous error, but I still have the issue :
|
below, the list of commands that I am doing: First I use nestJS with Nx so I transpile my app to JS using (I could use directly ncc with a tsconfig but it doesn't change the result):
Then I would use ncc to package the app (the output will be outside of the project to be sure no node_modules can be used):
Then I run my app:
To summarize a bit my env:
I am using nest grapqhql If I have time, I will create a small github project to reproduce my issue, thx for your help |
If it helps, the solution I found is to initialize an empty npm package in the generated dist folder from ncc and install graphql and type-graphql. It seems like the compiled file still depends on these packages, so it runs without problems now. |
@darklam indeed...this is working ! |
Just a heads up I ran into the same error after trying to recreate the sample code in the NestJS documentation website. I fixed the error by importing the RecipesModule into the app module. It seems an error is thrown if the app doesn't actually even have any endpoints to convert to the schema. Hope this helps someone! |
What do you mean by I don't know if it is related but after some code investigation, I discovered in nestJS that the
Does |
@gimyboya From my understanding, the issue is that the resulting "compiled" index.js file still has some external dependencies to graphql and type-graphql packages. So the way I fixed it is by taking the output dist from ncc, initializing an empty npm package and installing the graphql and type-graphql packages, so the dependencies are resolved correctly and everything works. Mind you, this was done in docker, so I am not sure how it will work with other environments. Also, I had problems compiling my ts nestjs server with the newer ncc releases, so I am currently still using the 0.18.5 version. In short the commands would look like:
Then, the index file inside dist should run correctly. Hope this helps you, if you have any more questions feel free to reply. EDIT: I just saw I said git repo in my previous reply, it was just my mind playing games, I actually meant empty npm package. Sorry if it caused any confusion. |
I think I can confirm that the issue concerning the fact that I updated
Mainly this PR makes the code more generic to allow using As you can see in line 9, the direct import to
Maybe @kamilmysliwiec or @styfle you have an idea how to solve this ? |
Just published 6.4.1 fix that will call |
@kamilmysliwiec It works ! Thx !! Just a little remark, do you load the library twice then ?
|
@1busby is right nestjs is trying to look for an endpoint to query to. i solve the solution with that little hint, though this issue is closed just for reference purpose guys. Your resolvers should provide endpoint for nest/grqphql should know |
I would like to use
ncc
to reduce my docker image size by removing the dependency tonode_modules
but I have a runtime issue :It seems there is still a dependency to the
node_modules
because it works with it...I have some compilation issue too but I don't know if it related:
Main libraries version:
The text was updated successfully, but these errors were encountered: