#[SOLVED] Events disappear after refreshing page

23 messages · Page 1 of 1 (latest)

mint sparrow
#

I understand we need to add the event to appwrite.json. But even after specifying it in json can't add event

#
{
    "projectId": "hidden",
    "projectName": "hidden",
    "events": [
        "databases.*.collections.chat.documents.create"
    ]
}

This is how my appwrite.json looks currently

molten girder
mint sparrow
#

@molten girder I am trying to add an event that will automatically trigger a function when any document inside the chat collection will be created. But as soon as I go to the appwrite cloud and try to create the event through the create event button and put in all details it is added but disappears on refresh

molten girder
#

Events disappear after refreshing page

molten girder
molten girder
mint sparrow
#

I see, can you guide me to where I can find an example appwrite.json file specific to this

molten girder
mint sparrow
#

No, I created it directly in cloud and then deploy using appwrite cli

mint sparrow
#

Thanks @molten girder ✨

mint sparrow
#

@molten girder I tried putting events under functions but still not working. I even tried creating function using appwrite init function and then adding an event and then updating the function

#

But everytime the event is sent as empty to the cloud by cli

#
{
    "projectId": "hidden",
    "projectName": "hidden",
    "functions": [
        {
            "$id": "hidden",
            "name": "createChatCollection",
            "runtime": "dart-2.17",
            "path": "functions/createChatCollection",
            "entrypoint": "lib/main.dart",
            "ignore": [
                ".packages",
                ".dart_tool"
            ],
            "execute": [],
            "events": [           "databases.*.collections.chat.documents.*.create"
            ],
            "schedule": "",
            "timeout": 15
        }
    ]
}

This is how my appwrite.json looks currently

#

I found out the issue

#

We need to hit update, even after clicking on create in events

#

Without update it just vanishes

#

Create event already has create button, so shouldn't create add the event instead of having to click on two buttons. I think it's a bit confusing for new comers

molten girder
mint sparrow
#

I updated from cloud console of appwrite (By clicking add event button)

molten girder
mint sparrow
#

No I understand that, I wanted to say that to update in console we are having to click on three buttons. "+ Add Event" -> "Create" -> "Update". I think if we didn't need to click on the last update button it would have been better from a UX point of view