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
Mock with Federations - Syntax Error: Unexpected Name "Hello" #348
Comments
are you using mock: true or passing in custom mocks?, Are you doing this in each mirco service or the gateway level service? |
I faced the same problem, when i wanted to mock federated services. When you use
Edit: After running into another problem, where extended type fields weren't mocked correctly, i now figured a way, that works for me quite well:
So, my bottomline is: don't use ApolloServers |
@schwarmco but isn't using |
Hey there I'm facing the same issue here, I think it will be pretty common to anyone relying on mocking locally to improve developer experience and then try to use Federation. I agree with @tzohpilotl, it defeats the purpose and reduce the power of the I've been digging in the code and the issue is the following: when providing a
When
From there, I only see two potential paths:
I think the second option is probably the way to go since when using AGM, the code will fetch the SDL from storage instead of hitting the federated service. (code) I will report back with any finding by tomorrow since I'm actively looking for a solution to this issue :) |
I've been playing with the code and I've found a way to have Federation to work with a federated service using mock. Here is what you would need to do:
Tomorrow I will attempt to use Apollo Graph Manager instead of passing a In the meantime, I hope this temporary solution will unblock you all :) |
Confirming that using AGM to manage your graph will then allow you to start federated services with the |
There is also string based query available on typeDefs, so that you do not need declare your schema as separate variable:
|
I had this issue recently, just set the following on the federated service: new ApolloServer({
...,
mockEntireSchema: false,
mocks: {},
}) And had the gateway use as normal. |
Hey! |
Closed via #1773 |
When using the '@apollo/federation' and ''@apollo/gateway' with mocked types and with micro server ('apollo-server-micro'). An error occurs on the gateway service:
Expected behaviour is to properly build the graph and use mocked types.
Actual behaviour, gateway is failing to load the types.
A workaround is to set the option: mockEntireSchema: false,
The text was updated successfully, but these errors were encountered: