I upgraded from 1.3.8 to 1.4.5 using the official commands (upgrade + migrate). My functions started not executing when my app calls them.
I figured all the updates I had to do (btw a migration guide would have been super useful, it's barely indicated in the documentation....)
Here is my function code now (a snippet) :
import datetime
import json
import os
import random
from appwrite.client import Client
from appwrite.query import Query
from appwrite.services.databases import Databases
def main(context):
context.log("Hello world!")
context.log(os.environ['APPWRITE_FUNCTION_PROJECT_ID'])
client = Client()
(
client
.set_endpoint("https://example.app/v1")
.set_project(os.environ['APPWRITE_FUNCTION_PROJECT_ID'])
.set_key(os.environ["APPWRITE_FUNCTION_API_KEY"])
)
try:
payload = json.loads(context.req.payload)
context.log(payload)
context.log(os.environ['APPWRITE_FUNCTION_USER_ID'])
user_id = os.environ['APPWRITE_FUNCTION_USER_ID']
context.log(payload, user_id)
except Exception as e:
context.error(e)
return context.res.send(e, 500)
It just fails everytime, I don't even have the log in the executions.
It simply spits out An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 652c11d386e18\nError Code: 500
What's the issue ?
Is this function from before 1.4?
Yes I created it even before 1.3.8
(I edited it to use context.res etc...)
Those will stay using the old format
To use the new format, you need to create a new function.
Or recreate the old one
The point was the old functions should have still worked after the upgrade
I guess, but it didn't work at all so I edited it but still nothing..
So...you probably should try to create a new function now to use the new format
Wait is it impossible to create a function without github now ?
I'm self hosting the github connection doesn't work well...
Oh okay I can do it with the CLI, not very convenient
What do you mean? CLI was the best approach before git.
Regardless you can upload manually like before too
Recommended threads
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...
- Triggers and call function in function p...
Hello, Today we are experiencing several issues with Appwrite Cloud. Functions triggered by events, or functions called from another function, are taking an e...
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...