#[SOLVED] Project ID not found

6 messages · Page 1 of 1 (latest)

fickle sage
#

I am getting this error while trying to use auth in appwrite:
Project with the requested ID could not be found. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.

My code:

`export class AuthService {
client = new Client();
account;

constructor() {
    this.client
        .setEndpoint(conf.appwriteUrl)
        .setProject(conf.appwriteProjectId);
    this.account = new Account(this.client);

}

async createAccount({ email, password, name }) {
    try {
        const userAccount = await this.account.create(ID.unique(), email, password, name);
        if (userAccount) {
            return this.login({ email, password });
        } else {
            return userAccount;
        }
    } catch (error) {
        throw error;
    }
}

async login({ email, password }) {
    try {
        return await this.account.createEmailSession(email, password);
    } catch (error) {
        throw error;
    }
}

async getCurrentUser() {
    try {
        return await this.account.get();
    } catch (error) {
        console.log("Appwrite serive :: getCurrentUser :: error", error);
    }

    return null;
}

async logout() {

    try {
        await this.account.deleteSessions();
    } catch (error) {
        console.log("Appwrite serive :: logout :: error", error);
    }
}

}

const authService = new AuthService();

export default authService`

I am doing const userData = await authService.createAccount(data) in another file to create account. Please forgive me if it is some trivial error as I am a newbie, also please dont delete this if it breaks any rule.

minor prism
#

whats the value of conf.appwriteProjectId?

fickle sage
minor prism
#

make sure there's no type, and the value isn't empty.

fickle sage
fickle sage
#

Project ID not found [SOLVED]