Back

Getting General Unknown 500 Error while calling account.createRecovery

  • 0
  • Web
  • Cloud
WildAnimal
24 Jan, 2024, 06:28

While calling account.createRecovery method to cloud.appwrite.io using web sdk, I got General Unknown 500 Error. I have checked my codes and cloud configuration items, and there are no issues. My project id is: yijiangaitu

TypeScript
export const createRecovery = async (email: string, url: string) => {
  const account = getAccount();
  return (
    email &&
    url &&
    (await account.createRecovery(email, url).then(
      () => {
        return Promise.resolve();
      },
      (error) => {
        return Promise.reject(error.message);
      }
    ))
  );
};

result:
{
    "message": "Server Error",
    "code": 500,
    "type": "general_unknown",
    "version": "0.12.48"
}
TL;DR
The developer is experiencing a General Unknown 500 Error while calling the `account.createRecovery` method. They have checked their codes and cloud configuration items but found no issues. They are wondering if the fact that the project ID matches the ID of a previously created (but deleted) project could have an impact. The code provided includes functions `getClient` and `getAccount` which are used to configure the client and account. There is no solution mentioned in the thread. Further investigation may be needed to troubleshoot the General Unknown 500 Error.
D5
24 Jan, 2024, 06:34

What does the getAccount function contains?

WildAnimal
24 Jan, 2024, 06:42
TypeScript
import { Client, Account, ID } from "appwrite";

export const getClient = () => {
  const ENDPOINT = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT;
  const PROJECT = process.env.NEXT_PUBLIC_APPWRITE_PROJECT;
  const client =
    ENDPOINT &&
    PROJECT &&
    new Client().setEndpoint(ENDPOINT).setProject(PROJECT);
  if (client) {
    client.setLocale("zh-cn");
    return client;
  } else {
    throw new Error("client is null");
  }
};

export const getAccount = () => {
  const client = getClient();
  if (client) {
    return new Account(client);
  } else {
    throw new Error("client is null");
  }
};
WildAnimal
24 Jan, 2024, 06:53

Possible useful information, this project ID matches the ID of a project I previously created (but deleted). But will this have an impact?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more