TypeError: Channel's second argument must be a ChannelCredentials

Moved from GitHub dgraph-js/7

Posted by MichelDiz:

I can use it perfectly without setting the credentials for gRPC. But I do not know if that would be a problem.

const clientStub = new dgraph.DgraphClientStub(
  // addr: optional, default: "localhost:9080"
  "192.168.99.100:9080",
  // credentials: optional, default: grpc.credentials.createInsecure()//
  grpc.credentials.createInsecure()
);

Here my dependencies

"dependencies": {
   "@babel/polyfill": "7.0.0-beta.32",
   "bluebird": "^3.5.1",
   "body-parser": "^1.18.2",
   "classnames": "^2.2.5",
   "cookie-parser": "^1.4.3",
   "core-js": "^2.5.1",
   "dgraph-js": "0.9.4-beta.1",
   "dgraph-node": "^0.1.9",
   "express": "^4.16.2",
   "express-graphql": "^0.6.11",
   "express-jwt": "^5.3.0",
   "graphql": "^0.11.7",
   "history": "^4.7.2",
   "isomorphic-style-loader": "^4.0.0",
   "jsonwebtoken": "^8.1.0",
   "node-fetch": "^1.7.3",
   "normalize.css": "^7.0.0",
   "passport": "^0.4.0",
   "passport-facebook": "^2.1.1",
   "pretty-error": "^2.1.1",
   "prop-types": "^15.6.0",
   "query-string": "^5.0.1",
   "react": "^16.1.1",
   "react-dom": "^16.1.1",
   "sequelize": "^4.22.6",
   "serialize-javascript": "^1.3.0",
   "source-map-support": "^0.5.0",
   "sqlite3": "^3.1.8",
   "universal-router": "^5.0.0",
   "whatwg-fetch": "^2.0.3"
 },
 "devDependencies": {
   "@babel/core": "7.0.0-beta.32",
   "@babel/node": "7.0.0-beta.32",
   "@babel/plugin-transform-react-constant-elements": "7.0.0-beta.32",
   "@babel/plugin-transform-react-inline-elements": "7.0.0-beta.32",
   "@babel/preset-env": "7.0.0-beta.32",
   "@babel/preset-flow": "7.0.0-beta.32",
   "@babel/preset-react": "7.0.0-beta.32",
   "@babel/preset-stage-2": "7.0.0-beta.32",
   "assets-webpack-plugin": "^3.5.1",
   "autoprefixer": "^7.1.6",
   "babel-core": "^7.0.0-0",
   "babel-eslint": "^8.0.2",
   "babel-jest": "^21.2.0",
   "babel-loader": "8.0.0-beta.0",
   "babel-plugin-transform-react-remove-prop-types": "^0.4.10",
   "browser-sync": "^2.18.13",
   "chokidar": "^1.7.0",
   "css-loader": "^0.28.7",
   "enzyme": "^3.1.1",
   "eslint": "^4.11.0",
   "eslint-config-airbnb": "^16.1.0",
   "eslint-config-prettier": "^2.7.0",
   "eslint-import-resolver-node": "^0.3.1",
   "eslint-loader": "^1.9.0",
   "eslint-plugin-css-modules": "^2.7.5",
   "eslint-plugin-flowtype": "^2.39.1",
   "eslint-plugin-import": "^2.8.0",
   "eslint-plugin-jsx-a11y": "^6.0.2",
   "eslint-plugin-prettier": "^2.3.1",
   "eslint-plugin-react": "^7.4.0",
   "file-loader": "^1.1.5",
   "flow-bin": "^0.59.0",
   "front-matter": "^2.3.0",
   "glob": "^7.1.2",
   "husky": "^0.14.3",
   "identity-obj-proxy": "^3.0.0",
   "jest": "^21.2.1",
   "jscodeshift": "^0.3.32",
   "lint-staged": "^5.0.0",
   "markdown-it": "^8.4.0",
   "mkdirp": "^0.5.1",
   "null-loader": "^0.1.1",
   "pixrem": "^4.0.1",
   "pleeease-filters": "^4.0.0",
   "postcss": "^6.0.14",
   "postcss-calc": "^6.0.1",
   "postcss-color-function": "^4.0.1",
   "postcss-custom-media": "^6.0.0",
   "postcss-custom-properties": "^6.2.0",
   "postcss-custom-selectors": "^4.0.1",
   "postcss-flexbugs-fixes": "^3.2.0",
   "postcss-import": "^11.0.0",
   "postcss-loader": "^2.0.8",
   "postcss-media-minmax": "^3.0.0",
   "postcss-nested": "^2.1.2",
   "postcss-nesting": "^4.2.1",
   "postcss-pseudoelements": "^5.0.0",
   "postcss-selector-matches": "^3.0.1",
   "postcss-selector-not": "^3.0.1",
   "prettier": "^1.8.2",
   "raw-loader": "^0.5.1",
   "react-deep-force-update": "^2.1.1",
   "react-dev-utils": "^4.2.1",
   "react-error-overlay": "^3.0.0",
   "react-test-renderer": "^16.1.1",
   "rimraf": "^2.6.2",
   "stylelint": "^8.2.0",
   "stylelint-config-standard": "^17.0.0",
   "stylelint-order": "^0.7.0",
   "svg-url-loader": "^2.3.0",
   "url-loader": "^0.6.2",
   "webpack": "^3.8.1",
   "webpack-bundle-analyzer": "^2.9.1",
   "webpack-dev-middleware": "^1.12.0",
   "webpack-hot-middleware": "^2.20.0",
   "webpack-node-externals": "^1.6.0"
 }

gpahal commented :

Can you try reinstalling your dependencies?
I think there is a mismatch between the grpc package you already had in your node_modules directory (dgraph-node requires grpc as well) and the one dgraph-js uses.

Just try reinstalling or updating dependencies.

MichelDiz commented :

I removed dgraph-node. That was it, I think it had a gRPC dependency with error. Thank you!

xSequential commented :

I also want to note on here, I needed to remove package-lock.json.