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
N
minutes, that will work best with what Steven said about timing. - Event-driven approach - create a function that will trigger on the
databases.*.collections.*.attributes.*.create
event, 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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- Our Appwrite organization is suspended
Please give support regarding this , no app is working now , please solve my issue and give support , no one is replying in message section or email.
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...