Back

[SOLVED] "buckets files create" FUNCTION_EVENT_DATA provides old data even with new file upload

  • 0
  • Functions
  • Storage
punti_z
18 Mar, 2023, 15:14

Facing this odd issue, I am uploading file to storage and using cloud function to do some transformation on the files and add associated data in a DB collection.

The first file I upload gets correctly processed and I can see correct file details stored in DB however every subsequent file upload triggers the same function but the event data is of the first uploaded file ?? The file in storage bucket is correct but the function still supplies old data.

TL;DR
The user was experiencing an issue where the "buckets files create" function was providing old data even with new file uploads. Another user suggested using `req.variables` instead of `req.variables[APPWRITE_FUNCTION_EVENT_DATA]` to fix the problem. The original user confirmed that this solution worked for them.
Drake
18 Mar, 2023, 15:28

Make sure you're using req.variables and not the operating system's environment variables

punti_z
18 Mar, 2023, 15:31

This is what I am using, do I need to go req. variables[`APPWRITE_FUNCTION_EVENT_DATA] ?

Drake
18 Mar, 2023, 15:36

Yes, you should use req.variables

punti_z
18 Mar, 2023, 16:09

Understood let me test and come back

punti_z
18 Mar, 2023, 16:29

Thanks @Steven that indeed fixes it.

punti_z
18 Mar, 2023, 19:39

[SOLVED] "buckets files create" FUNCTION_EVENT_DATA provides old data even with new file upload

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