GraphQL/APOLLO – Cannot query field “field_name” on type “Query”

GraphQL/APOLLO – Cannot query field “field_name” on type “Query”


0

I am trying to make a query like this in the latest apollo/server 4.9 and graphqlClient – 3.7 like below:

const USER_DATA = gql`
query getUserData($subdomain: String!) {
getUserData(subdomain: $subdomain) {
  _id
  full_name
  email
  valid_complex_password
  projects {
    _id
    image_url
    title
    description
    street_address
    city
    province
    country
  }
 }
}

but keep getting this:

{
"errors": [
    {
        "message": "Cannot query field "getUserData" on type "Query".",
        "locations": [
            {
                "line": 2,
                "column": 3
            }
        ],
        "extensions": {
            "code": "GRAPHQL_VALIDATION_FAILED",
            "stacktrace": [
                "GraphQLError: Cannot query field "getUserData" on type "Query".",
                ......
            ]
        }
    }
]

}

This same query used to work fine with older version of apollo server/client and graphql. Post upgrade it started breaking without any changes to schema etc.

Anything that needs to be changed in the way this is queried or I am missing something?

Migrated from

"apollo-server-errors": "^3.3.1",
"apollo-server-express": "^2.16.1",
"apollo-upload-server": "^7.1.0",
"graphql": "^14.6.0",
"graphql-compose": "^7.17.0",
"graphql-compose-aws": "^4.0.1",
"graphql-compose-connection": "^6.2.0",
"graphql-compose-mongoose": "^7.3.8",
"graphql-middleware": "^4.0.2",
"graphql-redis-subscriptions": "^2.2.2",
"graphql-tools": "^4.0.8",

To

"@apollo/server": "^4.9.5",
"graphql": "^16.8.1",
"graphql-compose": "^9.0.10",
"graphql-compose-aws": "^5.3.0",
"graphql-compose-connection": "^8.2.1",
"graphql-compose-mongoose": "^10.0.0",
"graphql-middleware": "^6.1.35",
"graphql-redis-subscriptions": "^2.6.0",
"graphql-subscriptions": "^2.0.0",

4

  • 1. Do other queries still work? 2. The server is returning this message correct? 3. Do queries still work from GraphiQL/Apollo Studio?

    – Michel Floyd

    48 mins ago

  • No, Yes and No!

    – beNerd

    43 mins ago

  • ok, so server is where it's at. What did you migrate to 4.9 from?

    – Michel Floyd

    42 mins ago

  • @MichelFloyd Please see my edit. Added where from we migrated to! Hope that helps

    – beNerd

    38 mins ago


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *