Back

Functions return different JSON after update?

  • 0
  • Self Hosted
  • Flutter
  • Functions
  • REST API
QuILLEMaster
23 Apr, 2024, 13:17

Hello everyone, i updated my appwrite backend from the version 1.3.8 to the version 1.4.14. Its works good except the json i return from my functions. After the updated the functions returning a whole new json data. Her is an example:

Here is the Json from the 1.4.14: {"payload":"{weeks:[{year:2024,kw:16}]}","data":{"0":{"year":2024,"kw"......

Here is the Json from the 1.3.8: {"payload":"{weeks:[{year:2024,kw:16}]}","data":[{"year":2024,"kw".....

You can see after "data" there is no "[" and a "0"?????

i have no idee why this is different because i didn't changed something.

I also updated every function with this document: https://appwrite.io/docs/products/functions/develop

For my frontend app this makes it unusable.

Thanks for all replies πŸ™‚

TL;DR
Issue: Functions return different JSON after update; Developers discuss the code and note potential issues with nested functions and object declarations that could affect the JSON output. One developer provides a helpful code snippet for a solution.
Meldiron
23 Apr, 2024, 14:59

Hi there. When developing feature for Appwrite 1.5, I saw similar weird behaviour. It comes from the way how deletion occurs in array_diff function of Appwrite APIs programming language.

This could be bug on API side. Can you please explain how this response is generated? It is probably forwarding data of some appwrite SDK response.

QuILLEMaster
29 Apr, 2024, 06:38
QuILLEMaster
29 Apr, 2024, 06:39

Hi there, thank you for your replie. Sorry that I answer so late :/. There is really a response. I create a document an send it to the database. I do this in a for loop to do this with multiple data

QuILLEMaster
29 Apr, 2024, 06:40

i hope this will help you πŸ™‚

QuILLEMaster
29 Apr, 2024, 06:45

calenderWeeks is delcared like this. maybe here i will get an error because of the declaration:

List<CalendarWeek> calendarWeeks = (listOfWeeks as Iterable) .map((e) => CalendarWeek(e['year'] ?? 0, e['kw'] ?? 0)) .toList();

Steven
29 Apr, 2024, 17:52

can you share more of the payload?

Steven
29 Apr, 2024, 17:52

this isn't coming out of realtime, is it?

Steven
29 Apr, 2024, 17:53

oh wait...this is your function code? why are you calling a function from in a function? 🧐

QuILLEMaster
30 Apr, 2024, 05:59

no this is coming out of a buffer πŸ₯²

QuILLEMaster
30 Apr, 2024, 06:00

this is the code above:

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