social_media_app
social_media_app copied to clipboard
The app crashed, appwrite error 401
Everything seemed to be working fine, but now I am getting this error, when I try to perform the basic functionalities like page refresh, logout, save post, even when starting the app.
I had this as well. In AuthContext.tsx remove the first checkAuthUser() in the useEffect() function. Works for me.
useEffect(() => {
console.log("useEffect->cookieFallback");
const cookieFallback = localStorage.getItem("cookieFallback");
if (
cookieFallback === "[]" ||
cookieFallback === null ||
cookieFallback === undefined
) {
navigate("/sign-in");
}
//checkAuthUser();
}, []);
const value = {
user,
setUser,
isLoading,
isAuthenticated,
setIsAuthenticated,
checkAuthUser,
};
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
}```
I had this as well. In AuthContext.tsx remove the first checkAuthUser() in the useEffect() function. Works for me.
useEffect(() => { console.log("useEffect->cookieFallback"); const cookieFallback = localStorage.getItem("cookieFallback"); if ( cookieFallback === "[]" || cookieFallback === null || cookieFallback === undefined ) { navigate("/sign-in"); } //checkAuthUser(); }, []); const value = { user, setUser, isLoading, isAuthenticated, setIsAuthenticated, checkAuthUser, }; return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>; }```
Well, I tried that and it stop complaining about AuthContext. But it is still complaining about getCurrentUser on every action (logout, like, save, etc.)
don't forget permissions in collections settings
I had this as well. In AuthContext.tsx remove the first checkAuthUser() in the useEffect() function. Works for me.
useEffect(() => { console.log("useEffect->cookieFallback"); const cookieFallback = localStorage.getItem("cookieFallback"); if ( cookieFallback === "[]" || cookieFallback === null || cookieFallback === undefined ) { navigate("/sign-in"); } //checkAuthUser(); }, []); const value = { user, setUser, isLoading, isAuthenticated, setIsAuthenticated, checkAuthUser, }; return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>; }```
Well, I tried that and it stop complaining about AuthContext. But it is still complaining about getCurrentUser on every action (logout, like, save, etc.)
In the config.ts file try replacing the values of appwriteConfig.projectId and url with the actual projectId and url inside double quotes in the setEnpoint and setProject method.
Failed to load resource: the server responded with a status of 500 ()
api.ts:52 AppwriteException: Server Error
at Client.
I am getting this error after making the above changes in the code
after doing this trying to signin but the toast message appers, that signin failed , also unable to go to the home page, its automatically redirect to the sigin page