Back

`node-apprwite` can't select attributes from users

  • 0
  • Self Hosted
Sam K
10 Feb, 2024, 17:30

I am trying to access the users from a cloud function and everything works good, but when I add the select attribute to only select couple of fields but I get this error:

{"code":400,"type":"general_argument_invalid","response":{"message":"Invalid queries param: Invalid query method: select","code":400,"type":"general_argument_invalid","version":"1.4.13"}}

this is my code

if (queryStr.lastId) { log('paginating') queries.unshift(Query.cursorAfter(decodeURIComponent(queryStr.lastId))) const response = await users.list([ ...queries, Query.select(['$id', 'name']) ]) return res.send(response) }

TL;DR
Developers are trying to select specific attributes from users using the `node-apprwite` library. However, they are encountering an error message stating "Invalid `queries` param: Invalid query method: select". The code snippet provided shows that the developers are trying to use the `select` method to choose the `$id` and `name` attributes. To resolve this issue, make sure that the library being used supports the `select` method for querying attributes. If it does not, consider using a different library or implementing custom code to retrieve the desired attributes.
D5
10 Feb, 2024, 17:57

You're trying to get 1 user?

D5
10 Feb, 2024, 17:58

The ID is unique, so I think you should not use list endpoint to get 1 user

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