Back

why it's saying Index not found in the cloud function Query

  • 0
  • Databases
  • Functions
manazo
8 Mar, 2023, 08:28

the first attachment (with lessThanEqual) is from the cloud function code. the second attachment is from the client-side code. and the third attachment shows my Indexes in appwrite console.

the client-side Query works fine. but in the cloud function, it says Index not found: createdBy,betDay. I've tried creating one single Index including both createdBy and betDay. Then it throws a Server Error

Any idea why it's happening and how to make this work?

Any kinda help will be appreciated

TL;DR
Title: Issue with Index Not Found in Cloud Function Query Messages: User is experiencing an issue where they are getting an "Index not found" error when using a cloud function query. They have tried creating a single index including both "createdBy" and "betDay", but it resulted in a "Server Error". They are looking for help on how to resolve this issue. Solution: User should check the Docker logs for the appwrite container to find more detailed information about the error. They can also refer to the Appwrite documentation on debugging for more assistance. Additionally, they may need to pass an ISO formatted string instead of a DateTime
Drake
8 Mar, 2023, 17:50

1st of all, it looks like you're doing a Query.equal() on createdBy Will you be doing a Query.search()?

manazo
9 Mar, 2023, 14:53

just tried. it's still saying index not found

Drake
9 Mar, 2023, 15:19

I'm just trying to understand what you need. Do you need to use the search query?

manazo
9 Mar, 2023, 15:25

no. i need the equal query. i need all docs where createdBy is equal to my passed "ID"

Drake
9 Mar, 2023, 15:26

Nice. Can you create 1 key (instead of full text) index with both attributes?

manazo
9 Mar, 2023, 15:32

says Search method requires fulltext. and when I tried fulltext type index, the index creation fails every time. no idea why

Drake
9 Mar, 2023, 15:32

You said you didn't need to use the search query 🧐

manazo
9 Mar, 2023, 15:42

i get what you're saying. i forgot to deploy my edits last time. but now when i'm trying to deploy, the deployment fails everytime. what could be the possible reason?

Drake
9 Mar, 2023, 16:17

what do the logs say?

manazo
11 Mar, 2023, 14:49

hi. sorry for the delay. the function is deployed successfully. but it's still not working. the log says Server Error. the attachment shows my current code

Drake
11 Mar, 2023, 15:59

Would you please check the docker logs for the appwrite container to find the 500 error? There should be a more detailed description

manazo
11 Mar, 2023, 16:33

I'm a bit too noob. can you please guide me about where I'll find the docker log for appwrite container?

Drake
11 Mar, 2023, 16:47
manazo
11 Mar, 2023, 16:59

DateTime::__construct(): Failed to parse time string (SatMar04202316:55:59GMT+0000(CoordinatedUniversalTime)) at position 0 (S): The timezone could not be found in the database that's the message I got. I think it's having some problem with the DateTime type data in "betDay"

Drake
11 Mar, 2023, 17:00

Oh. DateTime probably won't work. You'll need to pass an iso formatted string

Drake
11 Mar, 2023, 17:02

That said, we should probably improve the error handling. Would you be able to create an issue?

manazo
11 Mar, 2023, 17:06

i passed the Date Object I get via Javascript. I passed the same while creating the document. isn't it weird that it can create doc with Date objects, but fails in case of queries?

manazo
11 Mar, 2023, 17:07

on github? yeah, I think I can. I may need to know what exact info should i mention there about this situation

Drake
11 Mar, 2023, 17:10

In general, it's always good to include enough detail to make it clear and reproducible for others.

In this case, your code, what was actually sent in the network request or what the values passed into the queries were, and the error from the server is probably good.

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