Skip to content

Error while using "After" argument in a query #235

@Rahul-Sagore

Description

@Rahul-Sagore

I was trying to test "after" argument query to get paginated data, but got errors. This is the link for this feature's wiki: "After" argument

How to reproduce:

I created db entries with this: (Change the "Content 1" string for different text)

curl localhost:8080/query -XPOST -d $'mutation { set { <root> <content> <_new_:c> .
  <_new_:c> <text> "content 1" .
  }
}'

Then this was the query I was running to get first 3 entries:

curl localhost:8080/query -XPOST -d '{ 
    root(_xid_: root) { 
       content (after: 0x0, first: 3) { 
          _uid_ 
          text  
       }  
    }
}' 

It returned first 3 entries successfully:

{"root":{
   "content":[{
        "_uid_":"0xb05b747ccd23c34",
        "text":"content 1"
     },{
         "_uid_":"0x191a956b7d22db92",
         "text":"content 2"
     },{
        "_uid_":"0x1c9c592751305454",
        "text":"content 3"
    }]
  }
}

Then I used "uid" of last element to fetch the next 3 entries with this query:

curl localhost:8080/query -XPOST -d '{
  root(_xid_: root) { 
     content (after: 0x1c9c592751305454, first: 3) { 
         _uid_ 
         text  
      }  
   } 
}' 

But got this error :

{
   "code":"ErrorInvalidRequest",
   "message":"strconv.ParseInt: parsing \"0x1c9c592751305454\": value out of range"
}

This is the parse error, I don't know if I am doing something wrong, but it seems the dgraph's code is trying to parse "0x1c9c592751305454" with ParseInt, but the uid is not in form of integer and too long, that's why it failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething is broken.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions