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

Document that formatResponse also gets the query #1414

Closed
wants to merge 1 commit into from
Closed

Document that formatResponse also gets the query #1414

wants to merge 1 commit into from

Conversation

dandv
Copy link
Contributor

@dandv dandv commented Jul 24, 2018

No description provided.

@ghost ghost added the 📝 documentation Focuses on changes to the documentation (docs) label Jul 24, 2018
@unicodeveloper
Copy link
Contributor

Hey @dandv you didn't document that in this PR. Any reason why?

@martijnwalraven
Copy link
Contributor

Note that the shape of that query parameter is likely to change in the next version, so I wouldn't consider this part of the public API yet.

@dandv
Copy link
Contributor Author

dandv commented Jul 25, 2018

@unicodeveloper: I was respecting the doc style and thought that the "per input" part of "per input, response, and errors" refers to the query, since the error or response parameters aren't explicitly documented either, except by way of example.

But in the light of what @martijnwalraven said, feel free to close the PR without merging.

@dandv dandv deleted the patch-1 branch July 25, 2018 17:58
@dandv
Copy link
Contributor Author

dandv commented Dec 25, 2018

Looks like that change has occurred, and the query object no longer has queryString and variables. What is the current recommended way to log these for every query? The docs are vague.

@dandv
Copy link
Contributor Author

dandv commented Jan 20, 2019

Ping? This change breaks logging queries.

@ghost
Copy link

ghost commented Nov 13, 2019

Hi @dandv it was changed again, as a second param you will get request context:

requestContext: GraphQLRequestContext<TContext>,

@dandv
Copy link
Contributor Author

dandv commented Jan 16, 2020

I've been using this with v2.9.15:

new ApolloServer({
  // ...
  context: async ({ req }) => {
    const request = req.method === 'GET' ? req.query : req.body;  // POST vs. GET
    if (!request.query.startsWith('query IntrospectionQuery'))
      logger.info(`GraphQL query&variables`, {
        query: request.query,
        vars: request.variables,  // TODO: how are variables passed via GET?
      });
  }
});

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📝 documentation Focuses on changes to the documentation (docs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants