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

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

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

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?

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

it’s working great now