Skip to content
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

Access to the apollo-server #1268

Closed
tomasAlabes opened this issue Dec 3, 2020 · 2 comments
Closed

Access to the apollo-server #1268

tomasAlabes opened this issue Dec 3, 2020 · 2 comments

Comments

@tomasAlabes
Copy link

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I'm using schema stitching, and when the downstream services update their schemas, the gateway (the nestjs service) doesn't notice the changes.
This is not a problem of nestjs/graphql, this is discussed in ardatan/graphql-tools#791 and apollographql/apollo-server#1275.

Expected behavior

To do the workaround, we need access to the apollo-server. I couldn't find any reference in the doc.

Minimal reproduction of the problem with instructions

A -> B
\ -> C

Change C's schema, restart C and do a query involving that change to A.

What is the motivation / use case for changing the behavior?

If C changes its schema, only restarting A makes the stitching happen again.

@kamilmysliwiec
Copy link
Member

https://github.com/nestjs/graphql/blob/master/lib/graphql.module.ts#L53-L57

ApolloModule exposes the apolloServer getter that you can use :)

@sebastiangug
Copy link

for those reaching upon this thread in the future and hitting the 404 link, the way to get it is:

        let apolloServer: ApolloDriver;
        const moduleFixture = await Test.createTestingModule({
            imports: [AppModule],
        }).compile();
        app = moduleFixture.createNestApplication();
        await app.init();

        apolloServer = app.get<GraphQLModule<ApolloDriver>>(GraphQLModule).graphQlAdapter;

        apolloServer.instance.executeOperation(`......`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants