Back

Trigger function on document Creation

  • 0
  • Functions
  • Web
Rassvet
28 Sep, 2023, 15:23

Hi, I have a function that needs triggering when a document is created inside of a particular collection. how do I listen for the creation and trigger the function?

TL;DR
The user is having trouble triggering a function when a document is created in a specific collection. They mention checking the configuration in appwrite.json, events, and permissions. They tried adding an event listener and testing with admin access, but the permission roles disappeared. They also mention the CLI version they are using. There is no clear solution mentioned in the thread.
Rassvet
28 Sep, 2023, 15:25

I have deployed the function and if I set an event trigger to listen for the change, it works only once. then the event is removed

Drake
28 Sep, 2023, 17:23

and you're not deploying it again?

Drake
28 Sep, 2023, 17:26

what version are you on? I just tested and it looks like it stays for me...

Rassvet
28 Sep, 2023, 17:27

CLI is 4.1.0

Rassvet
28 Sep, 2023, 17:28

I added the event listener and tried with full admin access to any user and then tried function execution from client end and the permission roles also disappeared

Rassvet
28 Sep, 2023, 17:42

so it actually gets removed when we redeploy 😭 and I have been traumatized for the last 4 hours

Drake
28 Sep, 2023, 18:00

You'll need to make sure it's in the appwrite.json

Drake
28 Sep, 2023, 18:01

Events and permissions

Drake
28 Sep, 2023, 18:01

It should be everything. Make sure everything is configured in your appwrite.json

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