JS HTTP Client does not work in the browser as documented (trying to integrate with GatsbyJS, likely Webpack error)


Report a Dgraph Client Bug

I’ve been trying to integrate the Dgraph JS HTTP Client with GatsbyJS (https://www.gatsbyjs.com/). However it is failing.

What Dgraph client (and version) are you using?

  • Dgo
  • PyDgraph
  • Dgraph4J
  • Dgraph-js
  • Dgraph-js-http
  • Dgraph NET

Version: v21.03.0

What version of Dgraph are you using?

v20.11.2-rc1-23-gaf5030a5

Have you tried reproducing the issue with the latest release?

Not relevant.

What is the hardware spec (RAM, OS)?

Not relevant.

Steps to reproduce the issue (command/config used to run Dgraph).

Not relevant.

Expected behaviour and actual result.

The dgraph-js-http docs say “a Dgraph client implementation for javascript using HTTP. It supports both browser and Node.js environments” – it doesn’t work out of the box in the browser.

Other notes

I believe that it is a webpack issue. Initially the libraries crypto and stream were not found on the browser. After adding aliases pointing towards crypto-browserify and stream-browserify there was yet another error.

This time it was at this line – node-jsonwebtoken/psSupported.js at a46097e962621ab2ba718d1da6025cdeba3597c8 · auth0/node-jsonwebtoken · GitHubprocess not found

So, perhaps this is a webpack issue.

Please help resolve this. Also, it would help others if this is documented.

Thanks.

@dbx834 Can you share the code snippet of how you’re trying to setup the client?
The webpack issue seems unrelated to the client library.