now it got completed quickly
and got same error
{
"success": false,
"error": {
"code": 400,
"type": "attribute_not_available",
"response": {
"message": "Attribute not available: timestamp",
"code": 400,
"type": "attribute_not_available",
"version": "0.10.45"
}
}
}
not sure how to fix this now.
Yes, There is one more thing to add
One sec I'll update the snippet
okay, thank you
Done
okay, let me try again.
finally, it worked! 🎉
just putting my code here for future reference for other devs:
thank you so much both of you for helping me!!
[Solved] Cloud function Fails to create index
one last question,
what will happen when the attribute stays in a processing state for minutes?
because there is a function timeout of 15 seconds. so will it fail? or should I use self-hosted instead of cloud?
you should make sure to handle that case. at the moment, on cloud, it can take up to 30 minutes when there is a db backup going on
I'm no sure about your use case.
But, you can:
- **Scheduler **approach - Use cronjobs for the indexing part, and, let that part being executed once every
Nminutes, that will work best with what Steven said about timing. - Event-driven approach - create a function that will trigger on the
databases.*.collections.*.attributes.*.createevent, then add an index to that attribute.- With this approach you'll get it even before the attribute is ready, so make sure to check it.
- All-or-nothing approach - Do like the function you have here, and in cast ir fails just delete everything you've created.
It probably won't be good to extended the timeout time for a function like so.
If you need right now - as thing will, from what I've understand, be different when cloud's out of beta - then you can go the self-hosted route.
my use case is for one-one chat conversation.
every time when new user creates a chat, my cloud function executes and creates collection, storage bucket and all other stuff in the function code.
including index
so i can't make user wait for long. or else chat will not work
I see, that's keep thing the same. You just need to choose the right approach to handle the holding time.
The other approach could be by using teams, roles and leverage Appwrite permission with few collections to start with, check these:
thanks for this, I have already a working chat system, just needed to fix that cloud function error. let me show you some screenshots, it's in Flutter and Appwrite.
I haven't used the Team feature yet, so I'm just giving permission to only conversation participants to access the conversation colletion.
Recommended threads
- Confused about the pricing. Can I get so...
I 'm really confused about the pricing here. I've got the pro plan and i have 4 projects open. As you can see, I'm nowhere near my usage limits with these proje...
- Request for JWKS Endpoint and OIDC Disco...
Hey Appwrite Team, Do you have plans to support JWKS and a well-known OIDC discovery endpoint? This would let us verify Appwrite JWTs in other services using st...
- Cloud 500 error