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
- SELF HOSTING ISSUE, DATA NOT MIGRATING T...
Hey, devs, I recently tried to migrate my cloud instance to a self hosted version but my data is not transferred fully only the table structure is transferred ...
- No Document ID?
Hi I have a self hosted appwrite. My documents get a document ID but are not visible in the console. I don't know why this happens and how to fix this
- How to determine if a user is anonymous?
This is probably a silly question, but I have not yet found a good answer. Is there a method to determine if the current session is anonymous aside from seein...