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
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Appwrite Storage error 503s for automate...
I'm facing error 503s from Appwrite after about 5-6 seconds of making AI requests from my tool with images and files above 20MB (=> not inline base64 used, but ...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...