"setter is not a function" error in apollo client

Hi

I’ve been trying to use Apollo client to connect a keycloak-authenticated user with a Hasura GraphQL API. All went well until I tried to actually run a GraphQL query, when I’ve been confronted with the above error and the following stacktrace:

Error: setter is not a function
    at new ApolloError (index.js:26:1)
    at QueryManager.js:482:1
    at asyncMap.js:11:54
    at new Promise (<anonymous>)
    at Object.error (asyncMap.js:11:1)
    at notifySubscription (Observable.js:140:1)
    at onNotify (Observable.js:179:1)
    at SubscriptionObserver.error (Observable.js:240:1)
    at iteration.js:4:50
    at Array.forEach (<anonymous>)

If I use the token generated by Keycloak to directly query the API (e.g. through CURL), it works just fine - it’s only when I do it via this code when it comes awry:

const {
    loading: loadingFormOptions,
    data: formOptionData,
    error,
    networkStatus,
  } = useQuery(GET_SPECIALTY_FORM_OPTIONS);

Where GET_SPECIALTY_FORM_OPTIONS is a strong containing a GraphQL query.

Any ideas what I’m doing to break the nice things?

Could you show your client setup, especially your link chain?

1 Like

Oh my days, it seems like I had a massive mental block and used the wrong token to authenticated (the one from our former, non-keycloak provider). Now back to working as expected.

Thanks for the help - even if it was just asking for me to provide more details!! - it’s sorted it out :slight_smile:

1 Like