Back

[SOLVED] Invalid Json in trigger cloud function in dart

  • 0
  • Functions
Mosh Ontong
10 Dec, 2023, 15:53

ok i will do that

TL;DR
The user was experiencing an issue with an invalid JSON in a trigger cloud function in Dart. Steve suggested deleting the content type in the headers, which resolved the problem. It was discovered that the issue was caused by not passing valid JSON in the body. The user was unsure about the exact problem and mentioned executing the code in the Appwrite console still gave logs. It was suggested to share the code and flutter logs for further assistance.
Drake
10 Dec, 2023, 15:54

Then share what the flutter logs are and a screenshot of the code with the line numbers

Mosh Ontong
10 Dec, 2023, 16:05
Mosh Ontong
10 Dec, 2023, 16:05
Drake
10 Dec, 2023, 16:07

So this error is happening in the function itself

Drake
10 Dec, 2023, 16:09

You said there are no logs in or error in the function execution in the Appwrite console?

Drake
10 Dec, 2023, 16:09

Is your function code not executing at all?

Mosh Ontong
10 Dec, 2023, 16:10

yup

Mosh Ontong
10 Dec, 2023, 16:10
Mosh Ontong
10 Dec, 2023, 16:10
Drake
10 Dec, 2023, 16:11

What's your function code?

Mosh Ontong
10 Dec, 2023, 16:11

but when I execute that in appwrite console it gives an logs

Drake
10 Dec, 2023, 16:11

What were all the options when you ran from console?

Mosh Ontong
10 Dec, 2023, 16:12
Mosh Ontong
10 Dec, 2023, 16:12

Same path, no body

Mosh Ontong
10 Dec, 2023, 16:12

still gives me log

Drake
10 Dec, 2023, 16:12

Ok I think the problem is the header. You're telling Appwrite you're sending JSON, but you're not

Mosh Ontong
10 Dec, 2023, 16:13

but I am not what do you mean?

Drake
10 Dec, 2023, 16:14

You're not passing valid JSON in the body.

Mosh Ontong
10 Dec, 2023, 16:15

so it means it required to put this

Drake
10 Dec, 2023, 16:15

You need to pass some JSON body if you're going to put the headers saying you're passing json

Mosh Ontong
10 Dec, 2023, 16:15

Ohhhh I seeeeeee

Mosh Ontong
10 Dec, 2023, 16:16

so I should delete the content type in headers

Mosh Ontong
10 Dec, 2023, 16:18

thanks steve

Mosh Ontong
10 Dec, 2023, 16:51

[SOLVED] Invalid Json in trigger cloud function in dart

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