
I dont really understand why i am having this issues,
TypeScript
export default async ({ req, res }) => {
const client = new Client()
.setEndpoint(process.env.APPWRITE_ENDPOINT)
.setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
.setKey(process.env.APPWRITE_API_KEY);
const users = new Users(client);
const { email } = JSON.parse(req.body);
const list = await users.list({
queries: [Query.equal('email', email)],
});
if (list.total === 0) {
return res.json({ provider: null });
}
const userId = list.users[0].$id;
const identities = await users.listIdentities(userId);
const provider = identities.identities.length
? identities.identities[0].provider
: null;
return res.json({ provider });
};
TL;DR
The developer is encountering an issue with an invalid `queries` parameter, which must be an array. The code snippet provided shows an attempt to list users based on a query but is missing an array for the query. To fix this, modify the `queries` parameter to an array like so:
```javascript
const list = await users.list({
queries: [[Query.equal('email', email)]],
});
```
This change should resolve the issue and allow the function to work correctly.Recommended threads
- insecure connection on Appwrite sites de...
This only happens in microsoft edge for some reason. I inspected all network requests and they are all requesting https properly. All other browsers work fine. ...
- Building of functions not working anymor...
Function deployments get stuck on "waiting" for a long time, then on "building", then the build logs show an internal server error (500) before ultimately faili...
- Appwrite SSR Google OAuth (Invalid Redir...
I was following the documentation till here: https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-7#oauth-form Getting 301 err, I tried creating a new proje...
