Skip to content
Back

Problem with Event Trigger

  • 0
  • Self Hosted
  • Functions
A
24 Sep, 2024, 10:04

Hi! The function is triggered, when there is 'databases..collections..documents.*.update' but I see that the function is being executed times. Do you know why?

TL;DR
Developers seek help on extracting headers in Python functions, specifically the header x-appwrite-event. They are experiencing issues with an event trigger executing multiple times unexpectedly. The function is being triggered upon document updates, leading to it running multiple times. There is mention of replacing image names with URLs and creating summaries of markdown files in the database. A possible explanation is that the function is designed to execute upon any document update, which explains why it runs multiple times. The thread concludes with a user thanking for the solution provided.
Joshi
24 Sep, 2024, 10:07

That function will be executed anytime any document in any database and collection is being updated

A
24 Sep, 2024, 10:08
  1. Document updated --> 2. Function executed BUT why 3 times at once?
Joshi
24 Sep, 2024, 10:08

What does the function do

Joshi
24 Sep, 2024, 10:08

Does it by any chance update any document

A
24 Sep, 2024, 10:09

It creates a summary of all markdown files, that are existing in the db

Joshi
24 Sep, 2024, 10:10

Are you updating any document during that process

A
24 Sep, 2024, 10:11

it actually replaces the image names with their URLs, after getting the md content

Joshi
24 Sep, 2024, 10:11

There you have it

A
24 Sep, 2024, 10:12

Thanks!

A
24 Sep, 2024, 10:12

[SOLVED] Problem with Event Trigger

A
24 Sep, 2024, 10:16

why exactly is it being executed 3 times? Not 4 or more, for example 😄

Joshi
24 Sep, 2024, 10:16

Don't quote me on this but as far as I remember they have some measures in place to prevent infinite loop. Not totally sure tho

A
25 Sep, 2024, 06:16

Problem with Event Trigger

A
25 Sep, 2024, 06:18

Hi! Unfortunately, it is happening the same, when just adding new documents, not changing/updating them. Do you probably have any solution? (using Python)

Joshi
25 Sep, 2024, 06:19

Log the event string to see what event is causing it

A
25 Sep, 2024, 06:31

Sorry for the stupid question (as a beginner), but how to do this?

Joshi
25 Sep, 2024, 06:36

Retrieve the event string from the header x-appwrite-event

Joshi
25 Sep, 2024, 06:36

Do you know how to extract headers in python functions?

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