social_media_app icon indicating copy to clipboard operation
social_media_app copied to clipboard

The app crashed, appwrite error 401

Open athskouroliakos opened this issue 1 year ago • 6 comments

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. api401

athskouroliakos avatar Nov 12 '23 12:11 athskouroliakos

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>;
}```

AndrewDonelson avatar Nov 13 '23 04:11 AndrewDonelson

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.)

apprwrite_401

athskouroliakos avatar Nov 13 '23 13:11 athskouroliakos

image don't forget permissions in collections settings

EduardDE7 avatar Nov 21 '23 13:11 EduardDE7

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.)

apprwrite_401

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.

Rakshit358 avatar Nov 26 '23 06:11 Rakshit358

Failed to load resource: the server responded with a status of 500 () api.ts:52 AppwriteException: Server Error at Client. (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=2b5f3fef:850:17) at Generator.next () at fulfilled (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=2b5f3fef:488:24)

I am getting this error after making the above changes in the code

pratapKadam avatar Dec 25 '23 10:12 pratapKadam

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

juliusdhan avatar Mar 14 '24 17:03 juliusdhan