# Dgraph-js Slash ClientError: A valid API key was not passed in

**URL:** https://discuss.dgraph.io/t/dgraph-js-slash-clienterror-a-valid-api-key-was-not-passed-in/10767
**Category:** Dgraph Clients
**Created:** [October 5, 2020, 7:51am UTC](https://discuss.dgraph.io/t/dgraph-js-slash-clienterror-a-valid-api-key-was-not-passed-in/10767 "2020-10-05T07:51:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![scroobius-pip](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/scroobius-pip/32/1676_2.png) [@scroobius-pip](https://discuss.dgraph.io/u/scroobius-pip)
#### Post date: [October 5, 2020, 7:51am UTC](https://discuss.dgraph.io/t/dgraph-js-slash-clienterror-a-valid-api-key-was-not-passed-in/10767/1 "2020-10-05T07:51:21Z")

</div>

I’m currently connecting to the slash endpoint using the dgraph-js client like so:

```auto
const clientStub = new dgraph.clientStubFromSlashGraphQLEndpoint(address, apiKey)

const client = new dgraph.DgraphClient(clientStub)

```

I’m sure i’m passing the apikey correctly (it’s an env)

But from occasionally i get an error:

`ClientError: 2 UNKNOWN: A valid API key was not passed in`

---

<div class="post-metadata">

### Author: ![Anurag](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/anurag/32/2599_2.png) [@Anurag](https://discuss.dgraph.io/u/Anurag)
#### Post date: [October 5, 2020, 8:07am UTC](https://discuss.dgraph.io/t/dgraph-js-slash-clienterror-a-valid-api-key-was-not-passed-in/10767/2 "2020-10-05T08:07:41Z")

</div>

> [@scroobius-pip](#):
>
> But from occasionally i get an error:

You get this error occasionally and not always? This is weird.  
Update: We have identified a potential reason for this, could you share with us the snippet which you use to send queries?

---

<div class="post-metadata">

### Author: ![gja](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/gja/32/2654_2.png) [@gja](https://discuss.dgraph.io/u/gja)
#### Post date: [October 6, 2020, 2:45pm UTC](https://discuss.dgraph.io/t/dgraph-js-slash-clienterror-a-valid-api-key-was-not-passed-in/10767/3 "2020-10-06T14:45:48Z")

</div>

I think we found a bug in our system that was getting triggered. Please check if this is still broken for you.

---

<div class="post-metadata">

### Author: ![scroobius-pip](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/scroobius-pip/32/1676_2.png) [@scroobius-pip](https://discuss.dgraph.io/u/scroobius-pip)
#### Post date: [October 6, 2020, 9:33pm UTC](https://discuss.dgraph.io/t/dgraph-js-slash-clienterror-a-valid-api-key-was-not-passed-in/10767/4 "2020-10-06T21:33:15Z")

</div>

it’s working great now
