# "setter is not a function" error in apollo client

**URL:** <https://community.apollographql.com/t/setter-is-not-a-function-error-in-apollo-client/7794>\
**Category:** Client SDKs\
**Tags:** client\
**Created:** [September 4, 2024, 1:41pm UTC](https://community.apollographql.com/t/setter-is-not-a-function-error-in-apollo-client/7794 "2024-09-04T13:41:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![algy](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/algy/32/5277_2.png) [@algy](https://community.apollographql.com/u/algy)\
**Post date:** [September 4, 2024, 1:41pm UTC](https://community.apollographql.com/t/setter-is-not-a-function-error-in-apollo-client/7794/1 "2024-09-04T13:41:49Z")

</div>

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:

```auto
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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [September 4, 2024, 2:27pm UTC](https://community.apollographql.com/t/setter-is-not-a-function-error-in-apollo-client/7794/2 "2024-09-04T14:27:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![algy](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/algy/32/5277_2.png) [@algy](https://community.apollographql.com/u/algy)\
**Post date:** [September 4, 2024, 2:58pm UTC](https://community.apollographql.com/t/setter-is-not-a-function-error-in-apollo-client/7794/3 "2024-09-04T14:58:41Z")

</div>

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 🙂
