aws-mobile-appsync-sdk-js
aws-mobile-appsync-sdk-js copied to clipboard
lastSync on deltaQuery always has the same value
Do you want to request a feature or report a bug? Report a bug
What is the current behavior?
The argument lastSync passed to the delta query is always 1568094644 (Mon Jan 19 1970 03:34:54). According to the DeltaSync docs, the lastSync value is automatically populated by the AppSync client with the value of the lastTime the query was updated. In my case, the lastSync value is always the same.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
App.js
const appSyncClient = new AWSAppSyncClient({
url: awsconfig.aws_appsync_graphqlEndpoint,
region: awsconfig.aws_appsync_region,
auth: {
type: awsconfig.aws_appsync_authenticationType,
apiKey: awsconfig.aws_appsync_apiKey,
}
});
appSyncClient.hydrated().then(() => {
appSyncClient.sync(
buildSync('Order', {
baseQuery: {
query: gql(listOrders)
},
deltaQuery: {
query: gql(listOrdersDelta)
},
})
);
});
graphql.schema
type Query {
listOrders: [Order]
listOrdersDelta(lastSync: AWSTimestamp!): [Order]
}
type Order {
id: ID!
total: Float
subtotal: Float
tax: Float
createdAt: String!
}
What is the expected behavior? AppSync Client should keep track of the last time the deltaQuery was updated and send that value the next time it is invoked.
Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?
"dependencies": {
"aws-appsync": "^1.8.1",
"aws-appsync-react": "^1.2.9",
"expo": "^33.0.0",
"graphql-tag": "^2.10.1",
"react": "16.8.3",
"react-apollo": "^2.5.8",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
},
1568094644 is Tuesday, September 10, 2019 5:50:44 AM UTC (the day you filed this) when interpreted as seconds, not milliseconds. I'm not sure if the SDK is supposed to send seconds or milliseconds but it could be as simple as the wrong unit being used.