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

operationName is undefined #8845

Open
itxtoledo opened this issue Sep 25, 2021 · 3 comments
Open

operationName is undefined #8845

itxtoledo opened this issue Sep 25, 2021 · 3 comments

Comments

@itxtoledo
Copy link

Intended outcome:
show operationName

Actual outcome:
operationName is undefined

image

How to reproduce the issue:
Create two links and use this code to switch between them:

const splittedHttpLink = split(
  (operation) => {
    console.log("splittedHttpLink", operation);

    return operation.operationName === "refreshToken";
  },
  httpLink,
  batchHttpLink
);

Versions
System:
OS: Windows 10 10.0.19043
Binaries:
Node: 14.15.4 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.31)
npmPackages:
@apollo/client: ^3.4.13 => 3.4.13

@hwillson
Copy link
Member

@itxtoledo can you share what your refreshToken query looks like?

@itxtoledo
Copy link
Author

@hwillson

export const REFRESH_TOKEN_MUTATION = gql`
  mutation RefreshTokenMutation($token: String!, $refreshToken: String!) {
    refreshToken(token: $token, refreshToken: $refreshToken) {
      token
      refreshToken
    }
  }
`;

In the example i using this mutation but in all console.logs the operationName field is coming undefined

@LMaxence
Copy link

LMaxence commented Dec 9, 2021

Hello ! I encounter similar issues on every request coming from my ApolloClient. What is the status of this ?

const response = await apolloClient.mutate({
      mutation: gql`
        mutation doSomething($foo: String!) {
          doSomething(foo: $foo) {
            outcome
          }
        }
      `,
      variables: { foo: '' },
    });

leads to a body received as follows server side:

{ "query": "...", "variables": { "foo": "" } } 

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

No branches or pull requests

4 participants