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

@defer & @stream experimental usage & docs #7279

Closed
Banou26 opened this issue Jan 1, 2023 · 3 comments · Fixed by #7281
Closed

@defer & @stream experimental usage & docs #7279

Banou26 opened this issue Jan 1, 2023 · 3 comments · Fixed by #7281

Comments

@Banou26
Copy link

Banou26 commented Jan 1, 2023

Issue Description

When trying to follow the instructions for running @defer & @stream (as per #6827), tried using both the graphql 17.0.0-alpha.2 & 17.0.0-alpha.1, the server always return Unknown directive \"@defer\". as response.

I did also try 16.0.0-experimental-stream-defer.5, in which case, it didn't throw the Unknown directive \"@defer\". error but instead just returned an empty result from the http server.

Using the 16.0.0-experimental-stream-defer.5 experimental version did allow me to get a response from the executeOperation api, even thought it did not conform to the specs documented in #6827 and returned a body.singleResult looking like

{
  next: [Function: next],
  return: [Function: return],
  throw: [Function: throw],
  errors: undefined,
  [Symbol(Symbol.asyncIterator)]: [Function: [Symbol.asyncIterator]]
}

I'd really like to have some more documentation on how to use these features.

Link to Reproduction

https://github.com/Banou26/apollo-server-issue-7279

Reproduction Steps

accessing the sandbox and sending this request

  query GetBooks {
    books {
      title
      author
      ... @defer {
        test {
          foo
        }
      }
    }
  }

will result in a Unknown directive \"@defer\". error

@Banou26 Banou26 changed the title @defer & @stream experimental is broken? @defer & @stream experimental usage & docs Jan 1, 2023
@trevor-scheer
Copy link
Member

Hey @Banou26 - thanks for the reproduction. I've opened #7281 to add some documentation which will help you get past the error you're seeing.

trevor-scheer added a commit that referenced this issue Jan 4, 2023
Fixes #7279

<!--
First, 🌠 thank you 🌠 for taking the time to consider a contribution to
Apollo!

Here are some important details to follow:

* ⏰ Your time is important
To save your precious time, if the contribution you are making will take
more
than an hour, please make sure it has been discussed in an issue first.
          This is especially true for feature requests!
* 💡 Features
Feature requests can be created and discussed within a GitHub Issue. Be
sure to search for existing feature requests (and related issues!) prior
to
opening a new request. If an existing issue covers the need, please
upvote
that issue by using the 👍 emote, rather than opening a new issue.
* 🔌 Integrations
Apollo Server has many web-framework integrations including Express,
Koa,
Hapi and more. When adding a new feature, or fixing a bug, please take a
peak and see if other integrations are also affected. In most cases, the
fix can be applied to the other frameworks as well. Please note that,
since new web-frameworks have a high maintenance cost, pull-requests for
new web-frameworks should be discussed with a project maintainer first.
* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.
* 📖 Contribution guidelines
Follow
https://github.com/apollographql/apollo-server/blob/main/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
          tests for all new behavior.
* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
your
pull request is meant to accomplish. Provide 🔗 links 🔗 to associated
issues!

We hope you will find this to be a positive experience! Open source
contribution can be intimidating and we hope to alleviate that pain as
much as possible. Without following these guidelines, you may be missing
context that can help you succeed with your contribution, which is why
we encourage discussion first. Ultimately, there is no guarantee that we
will be able to merge your pull-request, but by following these
guidelines we can try to avoid disappointment.
-->
@Banou26
Copy link
Author

Banou26 commented Jan 22, 2023

@trevor-scheer little side question, would you happen to know if it's possible to force the package.lock to accept using "graphql": "^17.0.0-alpha.2", with @apollo/client@3.7.3, right now npm i fails because @apollo/client only accepts graphql@"^14.0.0 || ^15.0.0 || ^16.0.0" and that forces me to npm i --force which isn't possible on CIs, or maybe could ^17.0.0 be added to the @apollo/client accepted versions?

@trevor-scheer
Copy link
Member

Hey @Banou26, this is a common problem for now - tools don't really support v17 in their peer dependencies. We work around this in our CI using the --legacy-peer-deps flag. I went looking for docs on that flag to link you to, but didn't find any. Best I've got is this StackOverflow post. Hope that's helpful!

- run: npm i --legacy-peer-deps graphql@17.0.0-alpha.1.canary.pr.3361.04ab27334641e170ce0e05bc927b972991953882

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants