The continuation token specified in the request is malformed
See original GitHub issueHey,
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:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.