Skip to content
Back

The function execution failes even though it can be runned properly

  • 0
  • Databases
  • Functions
  • Users
  • Cloud
sidney
29 Jun, 2023, 13:24

I created a function in Python language to create a new user in Appwrite. After i run it in vs code, the new user is created in appwrite.

The problem is when I execute this function, it failes. <:appwritepeepo:902865250427215882>

Does anybody know the solution?

P.S I am using Appwrite Cloud

TL;DR
The function execution is failing even though it can be run properly. The error message indicates that there is an issue with parsing the request payload. The user suggests checking if the payload is a correct JSON. There is also a warning about an insecure HTTPS request. The user tries changing a parameter to `False` to address this warning, but it doesn't solve the issue. Other coworkers are facing the same problem. The user mentions that when they try another function to create a document, it is successful, but the function execution still fails. The user is advised to correct their code and consider using the Appwrite CLI or Appwrite starter structure for
Binyamin
29 Jun, 2023, 13:25

This is a deployed function? Or you're running it in your local machine?

sidney
29 Jun, 2023, 13:26

Yes, this is the deployed function.

Binyamin
29 Jun, 2023, 13:26

👍

Binyamin
29 Jun, 2023, 13:28

For deployed functions you'll need to use Appwrite starter structure. For example: https://github.com/appwrite/functions-starter/blob/main/python-3.8/src/index.py

The reason is that your function should declare a main function with the same signature in the above example.

Binyamin
29 Jun, 2023, 13:28

If you want the best way to create functions in Appwrite is to user Appwrite cli Like you can see here. https://appwrite.io/docs/functions#gettingStarted

sidney
29 Jun, 2023, 13:31

Thank you for your help. I will correct my code

sidney
29 Jun, 2023, 14:04

I tried another function to create a document. The new document was created but yet the function execution failed.

Binyamin
29 Jun, 2023, 14:06

What error you getting?

sidney
29 Jun, 2023, 14:08

In vs terminal or in appwrite server?

sidney
29 Jun, 2023, 14:11

InsecureRequestWarning: Unverified HTTPS request is being made to host 'cloud.appwrite.io'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings

sidney
29 Jun, 2023, 14:11

In appwrite there are no errors

Binyamin
29 Jun, 2023, 14:11

In Appwrite server

Binyamin
29 Jun, 2023, 14:12

So this is only in your local machine?

sidney
29 Jun, 2023, 14:19

yes

sidney
29 Jun, 2023, 14:20

My coworkers are facing the same issue

Binyamin
29 Jun, 2023, 14:42

What happened when you change it to False?

TypeScript
   .set_self_signed(False)
sidney
29 Jun, 2023, 14:56

The error about https request won't show anymore

sidney
30 Jun, 2023, 07:03

But it keeps failing

Binyamin
30 Jun, 2023, 13:20

Keep failing how? You get any logs?

Can you wrap your code in a try/except and share the Exception.

sidney
3 Jul, 2023, 10:05

Response: Invalid request payload

sidney
3 Jul, 2023, 10:05

logs: Failed to parse request payload: Expecting property name enclosed in double quotes: line 2 column 5 (char 6)

Binyamin
3 Jul, 2023, 13:17

Print the payload, and check that it's a correct JSON

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