Encountering a 401 Unauthorized error when attempting to create users
AI assistant suggested I need to create a "server" type API key instead of the current "standard" prefixed key, but my Appwrite console doesn't show any option to select API key types.
Environment
- Appwrite Cloud (NY server region)
- node-appwrite: v13 (downgraded)
- Frontend framework: NextJs
Troubleshooting Steps Taken
- Downgraded node-appwrite SDK to v13
- Recreated API keys
- Created mock user for testing - works successfully with mock data
- Researched Appwrite Discord
- Verified environment var configuration
Current API Key Configuration
- All available scopes are selected
- Key is properly configured in env variables
Suspected Issues Server region selection - NY server region compatibility issues
Frontend architecture compatibility - Current build approach may not be compatible with recent Appwrite updates
UserActions.ts
try {
if (!users) {
throw new Error("");
}
const newUser = await users.create(
ID.unique(),
user.email,
user.phone,
user.name
);
return parseStringify(newUser);
} catch (error: any) {
if (error...) {
const documents = await users.list([Query.equal("email", [user.email])]);
return documents.users[0];
}
console.error("", error);
throw error;
}```
***RegisterForm.tsx***
```const onSubmit = async (form validation) => {
setIsLoading(true);
try {
const user = {
name: values.name,
email: values.email,
phone: values.phone,
};
const newUser = await createUser(user);
if (newUser) {
router.push(`user endpoint`);
}
} catch (error) {
console.log(error);
}
};```
**Questions**
1. Are there known compatibility issues between FE impl. and specific server regions?
2. Has the API key creation process changed in Appwrite?
Recommended threads
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Appwrite console is too heavy
The Appwrite console is too heavy And all of my services broken Any support , please
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...