# Apollo VSCode plugin errors when autocompleting subscriptions

**URL:** https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382
**Category:** GraphQL
**Created:** [August 12, 2020, 12:27pm UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382 "2020-08-12T12:27:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![martaver](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martaver/32/8682_2.png) [@martaver](https://discuss.dgraph.io/u/martaver)
#### Post date: [August 12, 2020, 12:27pm UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382/1 "2020-08-12T12:27:39Z")

</div>

I’m generating an introspection schema from a /graphql endpoint using `import {getIntrospectionQuery} from 'graphql';`.

If I save that result as a json file and use it to power apollo vscode, then I get intellisense on all my graphql queries, yay! But… with the latest release of subscriptions I wanted to try them out and see what’s available.

I try and trigger intellisense within a subscription block:

```auto
subscription MySubscription() {
   // Here...
}

```

and nothing happens. At least, I don’t get any of the normal suspects.

In the Apollo GraphQL output window, every time I try to trigger intellisense I get:

```auto
[Error - 3:22:22 PM] Request textDocument/completion failed.
  Message: Request textDocument/completion failed with message: Cannot read property 'getFields' of undefined
  Code: -32603 

```

Not sure what’s displeasing the Apollo gods now… they sure seem fickle!

---

<div class="post-metadata">

### Author: ![Neeraj](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/neeraj/32/3104_2.png) [@Neeraj](https://discuss.dgraph.io/u/Neeraj)
#### Post date: [August 13, 2020, 3:09am UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382/2 "2020-08-13T03:09:35Z")

</div>

@MichelDiz, can you please look into this?

---

<div class="post-metadata">

### Author: ![Rahul](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rahul/32/3645_2.png) [@Rahul](https://discuss.dgraph.io/u/Rahul)
#### Post date: [August 13, 2020, 1:33pm UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382/4 "2020-08-13T13:33:16Z")

</div>

> [@martaver](#):
>
> If I save that result as a json file and use it to power apollo vscode

Are you referring VSCode plugin: [Apollo GraphQL - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo) ?

---

<div class="post-metadata">

### Author: ![martaver](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martaver/32/8682_2.png) [@martaver](https://discuss.dgraph.io/u/martaver)
#### Post date: [August 13, 2020, 5:41pm UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382/5 "2020-08-13T17:41:45Z")

</div>

Yep that’s the one!

---

<div class="post-metadata">

### Author: ![martaver](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martaver/32/8682_2.png) [@martaver](https://discuss.dgraph.io/u/martaver)
#### Post date: [September 6, 2020, 4:57am UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382/8 "2020-09-06T04:57:04Z")

</div>

Have since switched to using our own dgraph cluster from slash graphql, and upgraded to the latest version of dgraph 20.0.7… still getting the same issue!

---

<div class="post-metadata">

### Author: ![martaver](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martaver/32/8682_2.png) [@martaver](https://discuss.dgraph.io/u/martaver)
#### Post date: [September 6, 2020, 5:20am UTC](https://discuss.dgraph.io/t/apollo-vscode-plugin-errors-when-autocompleting-subscriptions/9382/9 "2020-09-06T05:20:15Z")

</div>

Actually, after further playing with

```auto
@withSubscription

```

I got it working… I realised when I added the tag, sometimes the schema update would fail with an unspecified error:

```auto
0] {"errors":[{"message":"resolving updateGQLSchema failed because rpc error: code = Unknown desc = error occurred updating GraphQL schema, please retry: Transaction has been aborted. Please retry","locations":[{"line":2,"column":5}]}],"data":{"updateGQLSchema":null},"extensions":{"tracing":{"version":1,"startTime":"2020-09-06T05:16:00.271019877Z","endTime":"2020-09-06T05:16:00.362229691Z","duration":91209824}}}

```

But after flipping the decorator on and off a few times, it eventually worked. Not sure what was wrong, I didn’t really do anything differently.

But at least now it works!
