-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Webpack puts multiple copies of graphql
in the bundle, leading to "Expected {...} to be a GraphQL schema" errors from graphql-js
#4983
Comments
@rmsy Thanks for the reproduction! I get a permissions error trying to run your Docker container; is it public?
|
I also get an error trying to
|
OK, I can run and reproduce it now. While I can't get This error almost certainly means that an I do see that if instead run I thiiiink this is an issue in your build process and not in AS itself so I'm going to close this for now but definitely interested in seeing if this can be tracked down further. How can I get webpack to not minify? |
All that is needed to prevent minification is the following added to optimization: {
minimize: false
}, However, trying without minification still results in the issue. Perhaps it could be related to webpack bundling, instead. I will attempt to reproduce without webpack and see if the problem persists, and I'll update here with what I find. Thanks for digging in to this! P.S. -- Just FYI, I've pushed an update to the repo that 1) fixes the issue you were having building the image, which wasn't happening to me (perhaps due to version), and 2) disables minification. (I've also pushed an update to the image, which is now public, to represent the "don't minify" setting). |
Cool. I ran
before the throw in assertSchema at line 59327. This prints
which shows that there are two different GraphQLSchema constructor functions floating around. (And you can see them both in the unminified file.) So I think this is a problem with your webpack/ts setup not deduping appropriately. Do let me know if it turns out to be triggered by something strange in apollo-server though! |
Any updates on how to fix this? I'm having a similar issue. |
Apologies for the late response -- as @glasser pointed at several times, this was indeed related to webpack. Once I removed webpack entirely, this issue immediately went away. I haven't investigated whether there is a way to make this work with webpack yet or not. |
I have also encountered this issue in my Apollo Webpack Typescript project, I have discovered the following: The extensions order inside the Webpack configuration seems to have a major influence. This will produce the error:
This will not produce the error:
|
graphql
in the bundle, leading to "Expected {...} to be a GraphQL schema" errors from graphql-js
My extensions were already
(I needed a |
My experience here is that by adding |
Same here. What I can also mention here is that I have |
this is the exact solution. after spending 2 days, only this solved the problem magically. |
Hello 👋
I'm attempting to set up a project using
apollo-server-lambda
, but I'm encountering the following issue when initializing theApolloServer
:I am using the exact same code as the getting started example, so I don't think the code is the issue here. The error I'm seeing is nearly identical to apollographql/apollo-client#6621, so I'm wondering if that issue may be related.
I've created a simple example project that you can use to reproduce this issue. You can run the example and reproduce the issue with the commands below:
Below are the package versions used in my example project. (I've never used Apollo before, so I don't know whether or not this issue is new to this version).
Any help would be appreciated; thank you for your time! 🙂
The text was updated successfully, but these errors were encountered: