Hi all,
I am self-hosting an Appwrite instance with the version 1.6.1 on a remote server and am running a web-app written in React in a container on the same host. My web-app is using node-appwrite version 13.0.0.
On one page, I need to be able to render information about all users so I use a Server Page to call Users.list to get all users to then pass that over to the Client Page.
That means, my page.tsx I have this code:
const prefs = await getAllUserPreferences();
return <ClientPage userPreferences={prefs} />
}
where the method getAllUserPreferences() looks like this:
// src/lib/server/appwrite.js
"use server";
import { Account, Client, Query, Teams, Users } from "node-appwrite";
export async function getAllUserPreferences() {
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT)
.setKey(process.env.NEXT_APPWRITE_KEY);
;
const users = new Users(client);
let filteredUserList = []
let userList = await users.list([Query.limit(100)])
for (const user of userList.users) {
const prefs= users.getPrefs(user_id)
filteredUserList.push({ $id: user.$id, name: user.name, preferences: prefs, email: user.email });
}
return filteredUserList;
}
Usually this works without any issues. If a new user registers though, this new user is not included in the return from users.list(). E.g., today a new user registered himself on my Web App and when I now open this page, I only get the information for every other user but not the new one.
The strange thing with this issue is that I only get it on the live Web App. If I build my project locally and run it, I always get all users. Also, after I update my App and upload it to live, it works as well.
I also checked if there is some caching that is interfering but I was able to exclude that as a reason.
Does anybody have an idea what causes this?
Recommended threads
- Local appwrite run functions --user-id n...
Hi, I'm running into an issue when testing Appwrite functions locally with user impersonation. I'm using a self-hosted Appwrite instance and running functions ...
- Impossible to get USER after createEmail...
Am using provider to deal with functions linked to appwrite. Here is my login. Future<String?> login(String email, String password) async { try { aw...
- Selfhosted Github App installation
I've followed this guide: https://appwrite.io/docs/advanced/self-hosting/configuration/version-control to connect GitHub to my self-hosted Appwrite instance (1....