HTTP API error with Drop operation with Unexpected \""

$ curl -X POST localhost:55007/alter -d '{"drop_op": "DATA"}'
{"errors":[{"message":"while lexing {\"drop_op\": \"DATA\"} at line 1 column 1: Invalid schema. Unexpected \"","extensions":{"code":"Error"}}]}%

This error in general happens when you copy and paste the command. Sometimes the Discourse create some “dirty” with copy paste. It changes some characters. This error that you’ve shared is in general a (aka open quote) instead of '. They look similar, but one is a typical sign for latin languages and the other a real single quote.

I did it again by retyping the data portion. Exact same error I am seeing on this image :frowning:

See this example.

I know it is working for you. It is not working for me with the latest version of that image :frowning:

This time I hand typed everything.

~/code/go/src/github.com/dgraph-io/travel on  master! ⌚ 14:29:31
$ curl -X POST localhost:55007/alter -d '{"drop_op": "DATA"}'
{"errors":[{"message":"while lexing {\"drop_op\": \"DATA\"} at line 1 column 1: Invalid schema. Unexpected \"","extensions":{"code":"Error"}}]}%

I have tested this on mac and it is reproducible. Not sure why, makes no sense, so it is a bug.

This PR that changes the protobuf generation in the latest master branch broke the drop data request:

fde7e6421ded7046c01d4f3801be17ef8a2b2f84 is the first bad commit
commit fde7e6421ded7046c01d4f3801be17ef8a2b2f84
Author: Naman Jain <naman@dgraph.io>
Date:   Mon Jan 25 15:59:15 2021 +0530

    chore: update protos to use protoc-gen-gogofaster (#7336)

    With protoc-gen-gofast, we had some extra XXX_ fields. Using gogofaster removes these extra fields.

@Naman Can you look into this?

@bkennedy You can use Dgraph v20.11.1 version (latest) in the mean time.

Brilliant work. Thanks!!

1 Like

Looking into this.
It is throwing the error unknown value "DATA" for enum api.Operation_DropOp at

curl -X POST localhost:55007/alter -d '{"drop_op": 2}'

The above will work. Something is wrong with enum parsing.

1 Like

@bkennedy https://github.com/dgraph-io/dgraph/pull/7382 PR fixes this issue. Thanks for reporting.

1 Like

The PR fix has been merged in master @bkennedy. Thanks @Naman for the quick fix!

Tests are passing on master now!! Thank you everyone for the help.

2 Likes