Closed Ajmaljalal closed 11 months ago
Hi @Ajmaljalal 👋 thanks for raising this issue. Can you share the outgoing request from the Next.js app (from the Network activity tab) and the one from the AppSync console for us to compare?
Is there any difference between calling APi.graphql
on the client side vs the server?
@chrisbonifacio here are the outgoing request: from Next.js app network tab
query FeedPostsByDate($type: String!, $createdAt: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelFeedPostFilterInput, $limit: Int, $nextToken: String)
variables: {limit: 2, type: "FeedPost", sortDirection: "DESC",}
limit: 2
nextToken: "eyJ2ZXJzaW9..."
sortDirection: "DESC"
type: "FeedPost"
and here is the query from aws console appsync
query MyQuery { feedPostsByDate(type: "FeedPost", limit: 2, sortDirection: DESC nextToken: "eyJ2ZXJzaW9...") { nextToken items { title } } }
and there is no difference between calling Api.graphql on the client side vs the server side. However the first call is happening on the server via getStaticProps and the nextToken from there is returned as a prop and then used from the client for future request.
I want to make sure I understand the flow and issue:
data
and nextToken
.data
and nextToken
are passed to clientnextToken
data
(populated with data) and nextToken
(null
, even though more data is expected)Is that correct?
When you've run this in console, did you use the same auth mode and user that the client is using?
@Ajmaljalal, are you still experiencing this issue? If so, can you respond to the questions above regarding your flow and auth mode?
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.
Thank you!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
GraphQL API
Amplify Categories
api
Environment information
Describe the bug
I am trying to get paginated data, the first time api call returns nextToken string but for consequent request, the nextToken is null even I have data in the DB table.
Expected behavior
it should return nextToken till there is no data remaining
Reproduction steps
Code Snippet
Log output
aws-exports.js
const awsmobile = { "aws_project_region": "us-west-2", "aws_cognito_identity_pool_id": "us-west-2:6d33d615-44df-4678-a56f-146e1deef0aa", "aws_cognito_region": "us-west-2", "aws_user_pools_id": "us-west-2_YT3xMoe9b", "aws_user_pools_web_client_id": "3ek3fqe40m4qhufugdj7fo6f7n", "oauth": {}, "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [], "aws_cognito_signup_attributes": [ "EMAIL" ], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [ "SMS" ], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ], "aws_appsync_graphqlEndpoint": "https://pu4w6grmsndcpcgorqzwarnx3m.appsync-api.us-west-2.amazonaws.com/graphql", "aws_appsync_region": "us-west-2", "aws_appsync_authenticationType": "API_KEY", "aws_appsync_apiKey": "da2-fkepuqnoajenplhkj4dhqfup6e" };
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response