Back

Function execution always fails

  • 0
  • Functions
A
9 Jul, 2024, 07:18

Hi, I started creating a simple function "Hello World!". The deployment works, but the execution fails. Another account created the function and it worked.

main.py

TypeScript
def main(request, response):
    return response.json({
        'message': 'Hello, World!'
    })

Error: Traceback (most recent call last): File "/usr/local/server/src/server.py", line 163, in action output = await asyncio.wait_for(execute(context), timeout=safeTimeout) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for return fut.result() File "/usr/local/server/src/server.py", line 156, in execute output = userModule.main(context) TypeError: main() missing 1 required positional argument: 'response'

TL;DR
Function execution fails due to a missing 'response' argument in the Python function code. Double-check the function's code and ensure it matches the Appwrite cloud requirements or your self-hosted Appwrite version.
Steven
9 Jul, 2024, 07:31

Are you using Appwrite cloud? If so, that's not what an Appwrite function looks like. Refer to the docs.

If you're self hosting, what version of Appwrite do you have?

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