Skip to content
Back

AppwriteException: Missing required parameter: "collectionId"

  • 0
  • Web
Soulfisher
23 Jun, 2025, 23:13

I'm having a problem accessing my users collection to list all my users. I was having trouble creating users but it has been resolved. I'm using react/nodejs on localhost. Please let me know what you need to see from my code or my IDE to fix this issue.

TL;DR
Developers encountering AppwriteException regarding missing parameter "collectionId" while trying to store or retrieve user data. To troubleshoot: 1. Check collection permissions in the Appwrite console. 2. Ensure collection attributes match schema fields accurately. 3. Confirm "storeUserData()" function execution. 4. Verify correct value for "collectionId" in the code. 5. Try manually passing params or print values for debugging. 6. Utilize Appwrite Users API in Node.js backend for fetching users. React or other frontend frameworks via the Client SDK cannot list all users directly; consider using Admin SDK or Databases API for custom collection access.
ɹǝpoƆʎɹᗡʎllıS
24 Jun, 2025, 03:22

@Soulfisher Hi, I am SillyDryCoder. From what you've described, here's a clarified breakdown of the issue and what needs to be checked:

Problem Summary You’re trying to list all users from your Appwrite project using React/Node.js on localhost. You resolved the user creation issue, but now you can’t access the users collection to list users.

Important Appwrite Context

🟨 In Appwrite, listing users is not possible from the Client SDK (i.e. from frontend React apps). ✅ It requires server-side access via Appwrite Admin SDK or the Appwrite Node.js SDK with API key & project permissions.

ɹǝpoƆʎɹᗡʎllıS
24 Jun, 2025, 03:24

Here are scenarios you could be stuck on: ✅ Option A: Server-Side Access using Node.js Admin SDK Use the official Appwrite Users API via Node.js backend with an API key that has users.read scope.

❌ Option B: Frontend Access using Client SDK (React, etc.) Not allowed — Appwrite Client SDKs do not support listing all users for security reasons.

*� Option C: Custom Users Collection If you created a custom Appwrite database collection named "users" (or similar), then: Each user would need to be added manually (e.g., at sign-up). You can use Databases API to list documents in this collection, even from the frontend, if permissions allow.

ɹǝpoƆʎɹᗡʎllıS
24 Jun, 2025, 03:26

Assuming you're using Node.js (backend) for fetching users: You must use the Users API:

`import { Client, Users } from 'node-appwrite';

const client = new Client() .setEndpoint('http://localhost/v1') // your Appwrite endpoint .setProject('PROJECT_ID') // your project ID .setKey('API_KEY'); // your API Key (with user.read scope)

const users = new Users(client);

(async () => { try { const allUsers = await users.list(); console.log(allUsers); } catch (err) { console.error('Error listing users:', err); } })();`

🔴 If you're trying to do this in a frontend (like React) using the Account API — it will not work.

ɹǝpoƆʎɹᗡʎllıS
24 Jun, 2025, 03:27
Soulfisher
24 Jun, 2025, 07:54

I have included a screen shot of my env file and the code I'm using to retrieve the data:

export const getAllUsers = async (limit: number, offset: number) => { try { const { documents: users, total } = await database.listDocuments( appwriteConfig.databaseId, appwriteConfig.userCollectionId, [Query.limit(limit), Query.offset(offset)] )

TypeScript
    if (total === 0 ) return { users: [], total }

    return { users, total };

} catch (e) {
    console.log('Error fetching users', e);
    return {users: [], total: 0 }
}

}

The name of my the collection that I'm trying to get the data from is 'users'.

From my view users page

export const loader = async () => { const { users, total } = await getAllUsers(10, 0);

TypeScript
return { users, total };

}

I blacked out my credentials. If you need to see them please let me know.

Darshan Pandya
24 Jun, 2025, 08:29

try manually passing the params to listDocuments or print the values of appwriteConfig.userCollectionId and appwriteConfig.databaseId via console.log. See there's no empty string or a typo.

Soulfisher
24 Jun, 2025, 10:00

Here's the error message that I'm getting:

Error fetching users: AppwriteException: Missing required parameter: "collectionId" at Databases.listDocuments (file:///Users/cassandracook/Code/tourvisto/node_modules/appwrite/src/services/databases.ts:26:19) at getAllUsers (/Users/cassandracook/Code/tourvisto/app/appwrite/auth.ts💯53) at loader (/Users/cassandracook/Code/tourvisto/app/routes/admin/all-users.tsx:15:50) at callRouteHandler (file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:10239:22) at commonRoute.loader (file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:10388:25) at actualHandler (file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:4128:14) at file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:4139:91 at runHandler (file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:4144:7) at callLoaderOrAction (file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:4191:22) at Object.resolve (file:///Users/cassandracook/Code/tourvisto/node_modules/react-router/dist/development/chunk-DQRVZFIR.mjs:4014:16) { code: 0, type: '', response: '' }

Darshan Pandya
24 Jun, 2025, 10:25

that simply means that the value of collectionId is not valid. verify the value of the collectionId that you are passing is correct. do a print via console.log or similar right before listDocuments to see the values.

Soulfisher
24 Jun, 2025, 10:39

It says undefined

Soulfisher
24 Jun, 2025, 10:43

But the page says no records found

Darshan Pandya
24 Jun, 2025, 10:45

means the collection id value doesn't exist. sdk is correct to throw an error.

ɹǝpoƆʎɹᗡʎllıS
24 Jun, 2025, 11:34

Maybe just check your .env stuff. Or the code handling around this.

ɹǝpoƆʎɹᗡʎllıS
24 Jun, 2025, 11:34

@Soulfisher

Soulfisher
24 Jun, 2025, 23:29

I verified the env ids from appWrite. Now the storeUser function is not hitting the collection either and its not throwing any errors. Here's my client file:

import {Account, Client, Databases, Storage} from "appwrite";

export const appwriteConfig = { endpointUrl: import.meta.env.VITE_APPWRITE_API_ENDPOINT, projectId: import.meta.env.VITE_APPWRITE_PROJECT_ID, apiKey: import.meta.env.VITE_APPWRITE_API_KEY, databaseId: import.meta.env.VITE_APPWRITE_DATABASE_ID, userCollectionId: import.meta.env.VITE_APPWRITE_USERS_COLLETION_ID, tripCollectionId: import.meta.env.VITE_APPWRITE_TRIPS_COLLECTION_ID }

const client = new Client() .setEndpoint(appwriteConfig.endpointUrl) .setProject(appwriteConfig.projectId)

const account = new Account(client); const database = new Databases(client); const storage = new Storage(client);

export { client, account, database, storage };

Here's a link to my repo: https://github.com/soulfisher/travel-agency-dashboard

Soulfisher
25 Jun, 2025, 05:40

Could this issue be because of the name of the collection?

ɹǝpoƆʎɹᗡʎllıS
25 Jun, 2025, 17:18

Maybe not. if its correct.

ɹǝpoƆʎɹᗡʎllıS
25 Jun, 2025, 17:21

I see your code. That's neat with no issues in my POV. Just check a few more things below IG.

  1. Check Collection Permissions

    Go to Appwrite console → Database → Collection → Permissions Ensure it allows write access for: * role:authenticated (if using user session) * or your API key (if using setKey())

  2. Validate Collection Attributes

    Make sure all fields (accountId, email, etc.) exist with correct types in the collection schema.

  3. Log Document Creation console.log("Created user:", createdUser);

    Helps catch silent failures or undefined returns.

  4. Enable Appwrite Logger client.setLogger({ log: console.log, error: console.error });

    See request logs and potential hidden errors.

  5. Ensure storeUserData() is Called

    Confirm it runs after login and isn’t skipped due to logic or redirect.

Soulfisher
27 Jun, 2025, 07:21
  1. I'm using an API key and I have given the collection all permissions for ANY.
  2. I have validatedfields are the same as the collection attributes.
  3. I get the 'Missing parameter' error for getUser, getExistingUser and storeUserData functions. These errors are almost immediate fired (there is no wait time).
  4. How do I implement this?
  5. storeUserData is being called - get the same error.
Soulfisher
31 Jul, 2025, 11:02

Hi everyone,

Thanks for all your help. I finally fixed it. I had a typo that I just found this morning.

Cassandra 😀

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more