Closed duranmla closed 1 year ago
Hey @duranmla when trying to sync as a guest user, are you seeing any errors in the console?
Also, can you share how you're configuring Amplify and/or DataStore?
Lastly, if you use the Hub utility listener, can you confirm if the ready
event is being emitted by DataStore?
For info on the Hub listener: https://docs.amplify.aws/lib/utilities/hub/q/platform/js/
👋 Hello @chrisbonifacio
My configuration looks like:
private setupAmplify(config: Object) {
// Allow to connect application with AWS Amplify
Amplify.configure({
...awsconfig,
// https://docs.amplify.aws/lib/datastore/setup-auth-rules/q/platform/js/#configure-multiple-authorization-types
DataStore: {
authModeStrategyType: AuthModeStrategyType.MULTI_AUTH,
errorHandler: (error: any) => {
logger.debug('Unrecoverable error', error)
},
},
})
}
I have a class that then I call in the root of my application as below:
useEffect(() => {
api
.init()
.then((synced) => {
setReady(synced)
})
.catch((err) => {
setError(err)
})
}, [api])
Full code of the class can be seeing at https://gist.github.com/duranmla/98e258a1fcb675984341bc54dd853ecf
Also, I can say that the 'ready' has been emitted cause I wait for that event before rendering the application. I actually suffer from another issue which is https://github.com/aws-amplify/amplify-js/issues/5963 but that's another subject completely different.
Also, in my case this issue was hidden because once you use the app as a logged user the data is on the indexdb so it was available for DataStore, but when I enter to the app with incognito window with everything empty, the sync does not happen and DataStore resolves empty for join tables.
Today, it happens the same with another relation and the solution will be the same, using AppSync query instead
I was able to reproduce this behavior with the reproduction steps given. Labeling as a bug for the team to investigate further.
I wasn't able to reproduce this with the latest version (5.0.15). It appears this issue was fixed accidentally with the release of v5. It is unlikely that we will be backporting a fix to v4. Please comment if you are still experiencing this issue on v5.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
DataStore
Amplify Categories
api
Environment information
Describe the bug
When using the application from Incognito (empty local storage, simulate first time users) my join tables are not being sync as the sync requests are not being triggered (join tables are being created automatically using
@manyToMany
directive in my schema)Once I login my user then I can see the sync requests being there.
Expected behavior
Sync requests to join table should always be trigger for guest and logged in users
Reproduction steps
Code Snippet
The case of study is with Project model and their connected models, here I show you the
Project
model withTag
model, other relations follow the same patternLog output
aws-exports.js
No response
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
https://www.loom.com/share/d4edda89883348ae826727796a6b8c24
Perhaps I am missing something and it is just a configuration thing. I am using Amplify CLI v10.2.3 in my CI due to https://github.com/aws-amplify/amplify-cli/issues/9508 and https://github.com/aws-amplify/amplify-js/discussions/10600