Schema {} query throws a TypeError


Report a Dgraph Client Bug

What Dgraph client (and version) are you using?

(put “x” in the box to select)

  • Dgo
  • PyDgraph
  • Dgraph4J
  • Dgraph-js (v21.03.1)
  • Dgraph-js-http
  • Dgraph.NET

Version:

What version of Dgraph are you using?

v21.03.0

Have you tried reproducing the issue with the latest release?

Yeah.

What is the hardware spec (RAM, OS)?

n/a

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

Run:

const txn = dgraphClient.newTxn();
const req = new dgraph.Request();
req.setQuery('schema {}');
const result = await txn.doRequest(req);

Expected behaviour and actual result.

I expected to get the full schema, all types and predicates.


I get this error:

TypeError: Cannot read property 'toObject' of undefined
    at Object.stringifyMessage (/Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/util.js:62:31)
    at Txn.<anonymous> (/Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/txn.js:152:94)
    at step (/Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/txn.js:44:23)
    at Object.next (/Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/txn.js:25:53)
    at /Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/txn.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/txn.js:15:12)
    at Txn.doRequest (/Users/dpk/Documents/git/api/node_modules/dgraph-js/lib/txn.js:143:16)

req.setQuery('schema(type: Foo) {}') works, successfully returning all the fields in type Foo.