Supporting grpc-js in dgraph-js

Hi,
I’m building a Node.js application using the dgraph-js client. So far I’ve been using the grpc node package, which works well, but is announced to be deprecated in 2021. A pure JavaScript gRPC client, @grpc/grpc-js is supposed to be its successor and intended as a drop-in replacement for grpc.
However, if I replace grpc with @grpc/grpc-js in my Node app, it fails to instantiate the Dgraph client.

A minimal example:

const grpc = require('@grpc/grpc-js')
const dgraph = require('dgraph-js')

const clientStub = new dgraph.DgraphClientStub(
  'localhost:9080',
  grpc.credentials.createInsecure()
)
new dgraph.DgraphClient(clientStub)

Throws:

node_modules/grpc/src/client.js:460
      this.$channel = new grpc.Channel(address, credentials, channel_options);
                      ^

TypeError: Channel's second argument (credentials) must be a ChannelCredentials
    at ServiceClient.Client (node_modules/grpc/src/client.js:460:23)
    at new ServiceClient (node_modules/grpc/src/client.js:986:12)
    at new DgraphClientStub (node_modules/dgraph-js/lib/clientStub.js:53:21)
    at Object.<anonymous> (index.js:4:20)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

I’d appreciate if someone could look into this!

I’ve found this pull request on Github, but I don’t know if it would help resolve the issue: https://github.com/dgraph-io/dgraph-js/pull/107