Sometimes, This error is appearing when trying to log in to my app. Is there any way to solve this issue?
Here is my login function,
authenticate({
onSuccess: () => {
if (!isWeb3Enabled) {
enableWeb3();
}
setIsLoading(false);
},
onError: (erorr) => alert(erorr),
signingMessage: "Mintzilla Platform"
});
useEffect(() => {
if (isAuthenticated) {
const sessionToken = user?.get('sessionToken');
redirectToIronSession(sessionToken, user.id);
}
}, [ isAuthenticated]);
async function redirectToIronSession(sessionToken: string, userId: string) {
const body = {
moralisSessionToken: sessionToken,
moralisUserId: userId,
};
try {
mutateUser(
await fetchJson('/api/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
);
} catch (error) {
console.log("redirectToIronSession", error);
if (error instanceof FetchError) {
alert(error.data.message);
} else {
console.error('An unexpected error happened:', error);
}
}
}