"Invalid pagination token given" on @key query
See original GitHub issueHaving a model with a key as following:
@key(
name: "byOrganization"
fields: ["organizationID"]
queryField: "merchantsByOrganizationID"
)
has generated resource template as following:
## [Start] Set query expression for @key **
#set( $modelQueryExpression = {} )
#if( !$util.isNull($ctx.args.organizationID) )
#set( $modelQueryExpression.expression = "#organizationID = :organizationID" )
#set( $modelQueryExpression.expressionNames = {
"#organizationID": "organizationID"
} )
#set( $modelQueryExpression.expressionValues = {
":organizationID": {
"S": "$ctx.args.organizationID"
}
} )
#end
## [End] Set query expression for @key **
#set( $limit = $util.defaultIfNull($context.args.limit, 10) )
#set( $QueryRequest = {
"version": "2017-02-28",
"operation": "Query",
"limit": $limit,
"query": $modelQueryExpression,
"index": "byOrganization"
} )
#if( !$util.isNull($ctx.args.sortDirection)
&& $ctx.args.sortDirection == "DESC" )
#set( $QueryRequest.scanIndexForward = false )
#else
#set( $QueryRequest.scanIndexForward = true )
#end
#if( $context.args.nextToken ) #set( $QueryRequest.nextToken = $util.toJson($context.args.nextToken) ) #end
#if( $context.args.filter ) #set( $QueryRequest.filter = $util.parseJson("$util.transform.toDynamoDBFilterExpression($ctx.args.filter)") ) #end
$util.toJson($QueryRequest)
Do results in a error when applying a nextToken:
com.amazonaws.deepdish.common.pagination.InvalidPaginationTokenException: Invalid pagination token given.
Amplify CLI Version 4.13.4
Additional context Applying the fix in #3452 on https://github.com/aws-amplify/amplify-cli/blob/master/packages/graphql-key-transformer/src/KeyTransformer.ts#L850 solves the issue.
I believe #3459 might be the same bug but was closed as fixed.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
How to use the "nextToken" parameter to test Pagination?
nextToken is a String that you get in the response when you send a request, looks like. and it has nothing to do...
Read more >Pagination error invalid token for Rest API Data Factory
Hi,. I am trying to use rest api to do pagination as it is just sending the first page in Azure ADF going...
Read more >Paginating table query results - Amazon DynamoDB
DynamoDB paginates the results from Query operations. With pagination, the Query results are divided into "pages" of data that are 1 MB in...
Read more >Token-based pagination - IBM Cloud Docs
The page token query parameter, which SHOULD be named start but MAY be named token , MUST be used to determine what resource...
Read more >Storyblok API Documentation
To perform a GET request with your token append the query parameter token ... 401 - Unauthorized, No valid API key provided. ......
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 Free
Top 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
It seems to work only when we use queries without any specific keys . For example
listJourneys (limit :5,nextToken :“sometoken”)
However if we were to use a query such as: listJourneys (journeyLong : true , limit:5 , nextToken :"sometoken) then it throws this error . We had the same issue at version 4.13.3 . However, 4.13.4 the issue seems to come up when using list queries on GSI . Please treat this as urgent as this is a blocker for us.
We released a fix for this with v4.14.1 today.