The continuation token specified in the request is malformed

See original GitHub issue

Hey,

I’m really having a hard time trying to make pagination work.

This is what i have:

find: function (querySpec) {
        var self = this;
        return new Promise((resolve, reject) => {
            var options = {
                maxItemCount: 2
            }
            var query = self.client.queryDocuments(self.collection._self, querySpec, options);
            query.executeNext(function (err, results, headers) {
                if (err) {
                    reject(err);
                } else {
                    self.continuation = headers['x-ms-continuation'];
                    resolve({ 'results': results, 'resource': headers['x-ms-resource-usage'] });
                }
            })
        });
    },
nextPage: function () {
        var self = this;
        console.log(this.continuation)
        return new Promise((resolve, reject) => {
            var options = {
                maxItemCount: 2
            }
            self.continuation ? options['continuation'] = self.continuation : '';
            var query = self.client.readDocuments(self.collection._self, options);
            query.executeNext(function (err, results, headers) {
                if (err) {
                    reject(err);
                } else {
                    resolve({ 'results': results, 'resource': headers['x-ms-resource-usage'] });
                }
            })
        });
    }

Continuation Token: {"token":"-RID:K0JYAKIH9QADAAAAAAAAAA==#RT:1#TRC:2","range":{"min":"","max":"FF"}}

Return Error: { code: 400, body: '{"code":"BadRequest","message":"Message: {\\"Errors\\":[\\"The continuation token specified in the request is malformed. Please re-run the query without it and iterate.\\"]}\\r\\nActivityId: 9e04278a-3808-4a59-8e63-dae191ef3519, Request URI: ...."}', activityId: '9e04278a-3808-4a59-8e63-dae191ef3519' }

What m’i doing wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
guptakumartanujcommented, Dec 13, 2017

I am just running into the same but for the cross partition query. So I am curious to know how to support pagination in my application when I have data across the partitions.

2reactions
srinathnarayanancommented, Nov 13, 2017

Hi @andrehsmendes can I know your use case? If you are trying to get pages of a fixed size, setting the maxItemCount in the options would be enough. The queryIterator returned will take care of the continuation token for subsequent ‘executeNext()’ operations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The continuation token specified in the request is malformed.
This is correct. The continuation token is specific to a query request and cannot be used with a different query (you'd either get...
Read more >
Continuation token specified in the request is malformed ...
First time I am getting first batch of results with continuation token in JSON format, but when I pass back that same token...
Read more >
Received a malformed token as part of a invalidation request
This guide will help you check for common problems that cause the log ” Received a malformed token as part of a invalidation...
Read more >
Pagination in Azure Cosmos DB
Learn about paging concepts and continuation tokens. ... The MaxItemCount is specified per request and tells the query engine to return that ...
Read more >
Role API | Alexa Smart Properties
The request is malformed or is missing one or more required parameters. 401. Unauthorized. The access token is missing, expired, or invalid.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found