Back

[Solved] Set the events in function

  • 0
  • Flutter
  • Functions
Mosh Ontong
12 Apr, 2023, 15:27

Whenever I redeploy my specific function, the event list I previously set up for it always gets deleted. Is this a bug, or is it intended to delete all the setup?

TL;DR
The user discovered that the event list they set up for a specific function gets deleted when they redeploy it. They are unsure if this is a bug or intended behavior. Another user suggests putting the event list in the `appwrite.json` file to avoid this issue. The solution is to include the event list in the `appwrite.json` file.
Ponguta_
12 Apr, 2023, 15:46

You should put the event list on your appwrite.json to avoid that

For example, I will copy here one of my functions:

TypeScript
{
            "$id": "conteo_registros",
            "name": "CONTEO_REGISTROS",
            "runtime": "python-3.9",
            "path": "functions/CONTEO_REGISTROS",
            "entrypoint": "src/index.py",
            "ignore": [
                "__pypackages__"
            ],
            "execute": [],
            "events": [
                "databases.*.collections.*.documents.*.create",
                "databases.*.collections.*.documents.*.delete"
            ],
            "schedule": "",
            "timeout": 15,
            "variables": {
                "ENDPOINT_API": "xxx",
                "PROJECT_ID": "xxx",
                "DB_ID": "xxx",
                "COLLECTION_MD_ID": "xxx",
                "API_KEY": "xxx"
            }

I hope it helps you

Mosh Ontong
12 Apr, 2023, 15:46

ohh Thank you sir

Ponguta_
12 Apr, 2023, 15:47

Also remember whenever you deploy a new function, you should deploy it twice.

this way env will be updated (idk why that happens).

Ponguta_
12 Apr, 2023, 15:47

You are always welcome

Mosh Ontong
12 Apr, 2023, 15:48

[Solved] Set the events in function

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