-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'operation' of undefined #11722
Comments
Hi @mhyassin can you run the Amplify CLI command Since this error seems to happen intermittently, could you check to see if there are any mutations being sent or pending mutations in the outbox when signing out? You can try enabling the Amplify logger by adding this line under the Amplify configuration
Or you should be able to use the Hub to listen to datastore events and log them to gain some more insight into what it's trying to do during sign out. |
Hi @chrisbonifacio, The project identifier is: 1f41c9d6304e82061193f8ee2e85ae0a |
Hi @mhyassin! Were you able to debug with any of @chrisbonifacio's suggestions (i.e. checking for the existence of pending mutations and / or debugging with additional logging)? |
Hey @david-mcafee, I tried debugging for some time, I'm sharing my findings below, Here is the full logout leading to the issue Tap hereLogs
p.s.: not sure if it is related but sometimes it just hangs on This is the issue on sentry:And this is our code details:// gets called when the user taps on the logout button
export const signout = async () => {
await resetApp();
try {
await Auth.signOut();
} catch (err) {
Alert.alert('Logout failed.');
}
}; export async function resetApp() {
await DataStore.clear();
} I've managed to hugly decrease the number of occurances by moving the useEffect(() => {
checkUser();
/** Hub listener callback */
const hubListener: HubCallback = (capsule) => {
// federatedSignIn triggers auth events
const event = capsule.payload.event;
switch (event) {
case 'signIn':
case 'cognitoHostedUI':
DataStore.clear().then(() => {
checkUser();
});
break;
default:
break;
}
};
return Hub.listen('auth', hubListener);
}, []); There is also another issue that happens alot in sentry, I was not able to reproduce myself to be honest and I'm not sure if it is related |
@mhyassin looking at the logs you provided, it looks like a mutation occurs after the sync engine has stopped. Is it possible that somewhere you are attempting to perform a mutation after calling Also, instead of listening for Hub.listen('auth', async (data) => {
if (data.payload.event === 'signOut') {
await DataStore.clear();
}
}); |
@mhyassin, did you get a chance to see the question and comment above? |
@cwomack Yeah, I did, I was giving it sometime to check Sentry, moving |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, Analytics, GraphQL API, DataStore, Storage
Amplify Categories
No response
Environment information
Describe the bug
We call DataStore.clear() while the user is signing out and some times after calling
await DataStore.clear()
I get this type error, not sure if it affects anything thoughExpected behavior
The promise rejection is handled correctly
Reproduction steps
Code Snippet
Log 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
No response
The text was updated successfully, but these errors were encountered: