Skip to content
Back

Functions not working since upgrade

  • 1
  • Functions
Baudouin Arbarétier
15 Oct, 2023, 16:29

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) :

TypeScript
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 ?

TL;DR
User is experiencing issues with their functions after a recent upgrade. They mention that the old functions should have still worked after the upgrade. The user has shared their function code. The function is failing with an internal curl error that says "Could not resolve host: 652c11d386e18". The user is asking for help in resolving the issue. Solution: The internal curl error suggests that there might be an issue with the host resolving. The user should check the connection settings and make sure the host URL is correct. Additionally, the user should verify if the project ID and API key are correct in the function code. If the
Drake
15 Oct, 2023, 16:44

Is this function from before 1.4?

Baudouin Arbarétier
15 Oct, 2023, 16:46

Yes I created it even before 1.3.8

Baudouin Arbarétier
15 Oct, 2023, 16:47

(I edited it to use context.res etc...)

Drake
15 Oct, 2023, 16:55

Those will stay using the old format

Drake
15 Oct, 2023, 16:58

To use the new format, you need to create a new function.

Drake
15 Oct, 2023, 16:58

Or recreate the old one

Drake
15 Oct, 2023, 16:58

The point was the old functions should have still worked after the upgrade

Baudouin Arbarétier
15 Oct, 2023, 17:00

I guess, but it didn't work at all so I edited it but still nothing..

Drake
15 Oct, 2023, 17:02

So...you probably should try to create a new function now to use the new format

Baudouin Arbarétier
15 Oct, 2023, 20:50

Wait is it impossible to create a function without github now ?

Baudouin Arbarétier
15 Oct, 2023, 20:50

I'm self hosting the github connection doesn't work well...

Baudouin Arbarétier
15 Oct, 2023, 20:55

Oh okay I can do it with the CLI, not very convenient

Drake
15 Oct, 2023, 21:14

What do you mean? CLI was the best approach before git.

Regardless you can upload manually like before too

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