Back

[SOLVED] Payload not passed anymore

  • 0
  • Cloud
MyWay
21 Sep, 2023, 22:39

Hi, before the recent update of appwrite cloud to 1.4.3, I was calling a function remotely with my data payload as a json string using curl.

Now apparently I'm not getting data anymore inside my function, did something change?

TL;DR
The user was experiencing an issue where their payload was not being passed anymore after an update to the Appwrite cloud. They initially asked if anyone had any insight or solutions to their problem. Some users suggested using the new domain and specifying the method and content type header. Another user mentioned that the parameter for the payload has changed from "data" to "body." The user eventually solved their issue by changing the URL to the new domain and updating their function. Solution: Update the URL to the new domain and change the parameter for the payload from "data" to "body."
D5
21 Sep, 2023, 22:54

Payload now doesn't exist

D5
21 Sep, 2023, 22:54

But body

MyWay
21 Sep, 2023, 23:37

How to pass it using curl?

btme0011
22 Sep, 2023, 07:22

To pass data in the body using curl, you can use the -d or --data option followed by the data you want to send. For JSON data, you would also typically set the Content-Type header to application/json. Here's an example:

TypeScript
curl -X POST "http://your-appwrite-function-endpoint" \
     -H "Content-Type: application/json" \
     -d '{"key1": "value1", "key2": "value2"}'

Replace http://your-appwrite-function-endpoint with your actual function endpoint and modify the JSON data as needed. This will send the data in the body of the request.

btme0011
22 Sep, 2023, 07:41

@D5 is there any other way of passing it through body?

MyWay
22 Sep, 2023, 08:29

I see. So maybe my issue is that req.payload has changed, when retrieving data?

MyWay
22 Sep, 2023, 09:20

I'm logging req, but body is always empty "", after the update

btme0011
22 Sep, 2023, 09:34

Can you show your log and your code once

MyWay
22 Sep, 2023, 10:06

I solved changing the url to the new domain one and updated the function too, no idea why though

MyWay
22 Sep, 2023, 10:07

So now I'm using req.body

Drake
22 Sep, 2023, 18:18

as D5 mentioned, the param is no longer data It has changed to body

See 1.4 docs vs 1.3 docs

MyWay
22 Sep, 2023, 18:22

Yeah I solved changing that but it wasn't enough, because for some reason I didn't receive the body anyway. After upgrading both the function and the caller (to use the new domain thing and to pass the body json directly) it worked though, thanks to you all

Drake
22 Sep, 2023, 18:27

it should have worked if you changed the param in the body client...or maybe you needed to specify the method and content type header as well..

MyWay
22 Sep, 2023, 18:30

Hmm no and this function I had was working because I used it until yesterday. No idea why though, maybe you can't pass the body without using the new domain thing?

Drake
22 Sep, 2023, 18:33

no, using the new domain is not a requirement

MyWay
22 Sep, 2023, 18:35

I see. No idea then

Drake
22 Sep, 2023, 18:35

[SOLVED] Payload not passed anymore

D5
22 Sep, 2023, 18:44

Yes, you can pass data through body

D5
22 Sep, 2023, 18:45

Please, create another post if you still need assistance

btme0011
22 Sep, 2023, 19:16

Yup read the doc make sense

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