Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing JSON from getData() #43

Closed
aryzing opened this issue Sep 28, 2018 · 1 comment · Fixed by #94
Closed

Error parsing JSON from getData() #43

aryzing opened this issue Sep 28, 2018 · 1 comment · Fixed by #94

Comments

@aryzing
Copy link

aryzing commented Sep 28, 2018

The code I'm running looks like

  const schema = `
    name: string @index(fulltext) .
    email: string @index(exact) .
  `;
  const op = new dgraph.Operation();
  op.setSchema(schema);
  const result = await dgraphClient.alter(op);
  return result.getData();

However, the getData() call is reporting a JSON parse error:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Payload.getData (/home/aryzing/workspace/anccre-server/node_modules/dgraph-js/lib/types.js:30:21)
@aryzing
Copy link
Author

aryzing commented Sep 28, 2018

Just ran result.getData_asB64() and it produced an empty string, so perhaps the issue is that getData() is not checking whether it's receiving an empty string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant