Skip to content

🐛 Bug Report: Functions not being executed #2940

Closed

Description

@onceuponacode

👟 Reproduction steps

Using Appwrite v:0.13.2.302 in docker
And running Appwrite cli v0.15.0

  1. Create function with (node-16.0 runtime):
appwrite init function
  1. Deploy function without editing it
appwrite deploy function  
  1. Open the created function in the function tab of the Appwrite UI
  2. Click on Execute Now without any custom data
  3. Go to Logs tab
  4. Click on the Errors button at the right of the execution's list item

Then you get the below described error.

👍 Expected behavior

The function should run

👎 Actual Behavior

I get this error : "
An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 622bb6f3725e4422610e-622d226c1a20e10fc330
"

When taking a closer look the host is comprised of 2 parts :

  • 622bb6f3725e4422610e: The project id
  • 622d226c1a20e10fc330: The function deployment id

Both of the parameters seemed to coincide with the ones, visible on the UI.

🎲 Appwrite version

Version 0.13.x

💻 Operating system

MacOS

🧱 Your Environment

I use Docker

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added
    bug
    on Mar 12, 2022
  2. rdmchr commented on Mar 13, 2022

    @rdmchr
    Contributor

    Hey,
    can you check your appwrite-executor logs? (docker logs appwrite-executor)
    If you have an error similar to this: Failed to Warmup Node.js 17.0! your issue is related to #2913
    Also, let me guess: You are running Ubuntu 20.04?

  3. onceuponacode commented on Mar 13, 2022

    @onceuponacode
    Author

    Hi,
    You were right for the logs but not the OS version.
    I am using OSX 12.2.1, and here are my logs:

    Warming up Node.js 16.0 environment...
    
    Warming up PHP 8.0 environment...
    
    Warming up Ruby 3.0 environment...
    
    Warming up Python 3.9 environment...
    
    Removing orphan runtimes...
    
    Successfully removed 622bb6f3725e4422610e-622d226c22f4c1a3eb56
    
    Failed to Warmup Ruby 3.0!
    
    Failed to Warmup Node.js 16.0!
    
    Successfully Warmed up Python 3.9!
    
    Failed to Warmup PHP 8.0!
    
    [Error] Type: Exception
    
    [Error] Message: Runtime not found. Please create the runtime.
    
    [Error] File: /usr/src/code/app/executor.php
    
    [Error] Line: 407
    
    Building container : 622bb6f3725e4422610e-622d226c22f4c1a3eb56
    
    Build Stage completed in 1 seconds
    
    Executing Runtime: 622bb6f3725e4422610e-622d226c22f4c1a3eb56
    
    [Error] Type: Exception
    
    [Error] Message: An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 622bb6f3725e4422610e-622d226c22f4c1a3eb56
    
    [Error] File: /usr/src/code/app/executor.php
    
    [Error] Line: 465
    

    Then it loops the last 5 lines several times, and presents the error in the UI.

  4. yngwi commented on Mar 14, 2022

    @yngwi

    Hi, I'm having the same problem. I have copied the code of the function and the executor log here but in essence it looks the same as the one by @onceuponacode. My server runs on Ubuntu 21.04, the Appwrite version is 0.13.2.

  5. kazkis commented on Mar 14, 2022

    @kazkis

    We are having this issue too , but we are using Docker Desktop running on Windows 10 (on WSL).
    We were testing AppWrite 0.12.x and everything was working fine. The problem started after updating to 0.13.x (and it's there even with a fresh install).
    Due to this, AppWrite Functions aren't working anymore.

  6. stnguyen90 commented on Mar 15, 2022

    @stnguyen90
    Contributor

    @onceuponacode, you might be executing the function before the runtime is ready. If you wait, do you eventually see logs about the runtime being created? You can also run docker ps to see if the 622bb6f3725e4422610e-622d226c22f4c1a3eb56 container is running.

  7. yngwi commented on Mar 15, 2022

    @yngwi

    @stnguyen90 Hi, I'm not @onceuponacode but I just had another look at "my version" of the problem and after several hours of the containers being up I tried to launch the request that triggers my function and this is the resulting executor log (starting from the beginning):

    Warming up Node.js 16.0 environment...
    Warming up PHP 8.0 environment...
    Warming up Ruby 3.0 environment...
    Warming up Python 3.9 environment...
    Removing orphan runtimes...
    Failed to Warmup PHP 8.0!
    Failed to Warmup Ruby 3.0!
    Failed to Warmup Node.js 16.0!
    Failed to Warmup Python 3.9!
    Running maintenance task ...
    Running maintenance task ...
    Running maintenance task ...
    Running maintenance task ...
    Running maintenance task ...
    Running maintenance task ...
    Running maintenance task ...
    [Error] Type: Exception
    [Error] Message: Runtime not found. Please create the runtime.
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 407
    Building container : 622db85c73275eca55b2-622eebe9020b8443d8b9
    Build failed: File Not Found
    [Error] Type: Exception
    [Error] Message: File Not Found
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 307
    
  8. christyjacob4 commented on Mar 15, 2022

    @christyjacob4
    Contributor

    @yngwi Can you create a new deployment and try again ?
    It seems we are unable to reproduce this issue.

  9. kazkis commented on Mar 15, 2022

    @kazkis

    I created a new project on a freshly installed Ubuntu 21.10 using Docker Engine 20.10.13 and got similar results:

    Warming up Node.js 16.0 environment...
    Warming up PHP 8.0 environment...
    Warming up Ruby 3.0 environment...
    Warming up Python 3.9 environment...
    Removing orphan runtimes...
    Failed to Warmup Ruby 3.0! 
    Failed to Warmup Node.js 16.0!
    Failed to Warmup PHP 8.0!
    Failed to Warmup Python 3.9!
    Building container : 6230f33c007f7f269715-6230f4eaa85017f532ef
    Build Stage completed in 7 seconds
    [Error] Type: Exception
    [Error] Message: Runtime not found. Please create the runtime.
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 407
    Building container : 6230f33c007f7f269715-6230f4eaa85017f532ef
    Build Stage completed in 0 seconds
    Executing Runtime: 6230f33c007f7f269715-6230f4eaa85017f532ef
    [Error] Type: Exception
    [Error] Message: An internal curl error has occurred within the executor! Error Msg: Connection refused
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 465
    Executing Runtime: 6230f33c007f7f269715-6230f4eaa85017f532ef
    

    The only thing I added to the project is the python function taken from the AppWrite docs (with manual deployment).

  10. kazkis commented on Mar 15, 2022

    @kazkis

    I tried using the CLI to deploy the same function instead of choosing the manual deployment (without changing anything else) and everything seems to work.
    There is probably something wrong with the manual deployment.

  11. yngwi commented on Mar 16, 2022

    @yngwi

    @yngwi Can you create a new deployment and try again ? It seems we are unable to reproduce this issue.

    I tried just now, same results. Maybe the container wiring is not correct? Following the installation procedure I'm using the networks appwrite and runtimes in the docker-compose.yml, but instead of the preconfigured traefik network, I'm using my own. Apart from that everything is the same. Now, the autogenerated env contains the following line: _APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes Is this correct?

  12. nickduncan7 commented on Mar 17, 2022

    @nickduncan7

    Fresh installation of Appwrite v0.13.3.303 on Ubuntu 20.04 with Docker 20.10.7 here. Trying the base Python 3.9 runtime. I've stripped my function code down to the barest of bones and I cannot get functions to execute.

    https://gist.github.com/nickduncan7/d79d8ca04adb2a12391f089d12c84fba

    My Python says it's able to warm up, so no issues there. I believe this function should follow the new format of function to export. I've tried with sample code from the Appwrite CLI as well and same thing.

    Also using the autogenerated env. Not much changed aside from https enabled by default. Any assistance is appreciated!

  13. stnguyen90 commented on Mar 17, 2022

    @stnguyen90
    Contributor

    Fresh installation of Appwrite v0.13.3.303 on Ubuntu 20.04 with Docker 20.10.7 here. Trying the base Python 3.9 runtime. I've stripped my function code down to the barest of bones and I cannot get functions to execute.

    https://gist.github.com/nickduncan7/d79d8ca04adb2a12391f089d12c84fba

    My Python says it's able to warm up, so no issues there. I believe this function should follow the new format of function to export. I've tried with sample code from the Appwrite CLI as well and same thing.

    Also using the autogenerated env. Not much changed aside from https enabled by default. Any assistance is appreciated!

    Anything in the build or runtime logs? How did you deploy your code? Feel free to join us on discord as it would be easier to troubleshoot there rather than go back and forth on GitHub.

  14. nickduncan7 commented on Mar 17, 2022

    @nickduncan7

    How do I check those logs? I deployed with the CLI via a Windows client, a Ubuntu client, and by uploading the code to the web interface directly. I followed the existing example generated from appwrite init function and in fact that example code does not run successfully either.

    With all due respect I've seen similar issues discussed on Discord with no apparent resolution to the problem, I'd prefer to keep the conversation here if that's possible.

    Edit: Figured out the runtime logs. That's given me enough info to go on, now I've got the sample function code working.

  15. yngwi commented on Mar 17, 2022

    @yngwi

    Hi again, I just tried a completely new local appwrite setup using the docker command from the installation instructions, then I created a simple collection and a function that tries to list the available documents by just copy&pasting code from the documentation. I then created a deployment using the appwrite cli that I also freshly installed in my WSL installation. I then executed the function several times using the CLI and the browser based admin interface, with the same result again:

    me@WSL:~/tmp/appwrite$ docker logs appwrite-executor -f
    Warming up Node.js 16.0 environment...
    Warming up PHP 8.0 environment...
    Warming up Ruby 3.0 environment...
    Warming up Python 3.9 environment...
    Removing orphan runtimes...
    Failed to Warmup Ruby 3.0!
    Failed to Warmup Node.js 16.0!
    Failed to Warmup PHP 8.0!
    Failed to Warmup Python 3.9!
    Building container : 62336741a47377184a9e-62336809c339a4f8a231
    Build Stage completed in 9 seconds
    [Error] Type: Exception
    [Error] Message: Runtime not found. Please create the runtime.
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 407
    Building container : 62336741a47377184a9e-62336809c339a4f8a231
    Build Stage completed in 1 seconds
    Executing Runtime: 62336741a47377184a9e-62336809c339a4f8a231
    [Error] Type: Exception
    [Error] Message: An internal curl error has occurred within the executor! Error Msg: Connection refused
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 465
    Executing Runtime: 62336741a47377184a9e-62336809c339a4f8a231
    Function executed in 0.090941905975342 seconds, status: completed
    Executing Runtime: 62336741a47377184a9e-62336809c339a4f8a231
    Function executed in 0.0027098655700684 seconds, status: completed
    Executing Runtime: 62336741a47377184a9e-62336809c339a4f8a231
    Function executed in 0.0022468566894531 seconds, status: completed
    Building container : 62336741a47377184a9e-62336957e316b4a0b944
    Build Stage completed in 7 seconds
    [Error] Type: Exception
    [Error] Message: Runtime not found. Please create the runtime.
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 407
    Building container : 62336741a47377184a9e-62336957e316b4a0b944
    Build Stage completed in 1 seconds
    Executing Runtime: 62336741a47377184a9e-62336957e316b4a0b944
    [Error] Type: Exception
    [Error] Message: An internal curl error has occurred within the executor! Error Msg: Connection refused
    [Error] File: /usr/src/code/app/executor.php
    [Error] Line: 465
    Executing Runtime: 62336741a47377184a9e-62336957e316b4a0b944
    Function executed in 15.015694856644 seconds, status: failed
    Executing Runtime: 62336741a47377184a9e-62336957e316b4a0b944
    Function executed in 15.012204885483 seconds, status: failed
    

    I'm not sure what else I can try to fix function execution for me, this is as vanilla as I can get, I guess. I'm grateful for all pointers.

  16. 29 remaining items

  17. andreped commented on Dec 16, 2022

    @andreped

    Noticed that this issue has been closed, but I'm still having this issue with manual deployment.

    I followed the tutorial on how to setup a simple function and deploy it through appwrite, but it fails during execution.

    I have setup appwrite through docker on macOS, with the latest version (1.1.2).

  18. MyWay commented on Dec 16, 2022

    @MyWay

    Same here.

  19. BraveDevelopment commented on Dec 25, 2022

    @BraveDevelopment

    Noticed that this issue has been closed, but I'm still having this issue with manual deployment.

    I followed the tutorial on how to setup a simple function and deploy it through appwrite, but it fails during execution.

    I have setup appwrite through docker on macOS, with the latest version (1.1.2).

    Same here.

  20. memetrusidovski commented on Jan 1, 2023

    @memetrusidovski

    having the same issue as the users above

  21. stnguyen90 commented on Jan 10, 2023

    @stnguyen90
    Contributor

    For anyone still having problems, please join us on Discord to troubleshoot since each problem needs to be addressed on a case-by-case basis.

  22. Kvark1205 commented on Feb 14, 2023

    @Kvark1205

    For anyone who have this kind error as TC:

    An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 622bb6f3725e4422610e-622d226c1a20e10fc330

    In docker-compose.yml declared networks doesn't have specific names and when you up your containers from docker-compose it creates networks with template as "directory-name-of-compose-location"_"network-in-compose-file".

    So, in .env described network is hardcoded as _APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes which only work if your docker-compose.yml file located in appwrite directory.

    To avoid that do the next:

    1. Define specific network names in docker-compose.yml like this (be aware that they must be unique because of docker-host scope):
    ...
    networks:
      gateway:
        name: gateway
      appwrite:
        name: appwrite
      runtimes:
        name: runtimes
    ...
    1. Change .env and set your correct defined networks:
    ...
    _APP_EXECUTOR_RUNTIME_NETWORK=runtimes
    OPEN_RUNTIMES_NETWORK=runtimes
    ...
    1. Recreate containers for applying changes:
    docker-compose up -d
    
    1. Try to execute function from UI and after function execution you can find newly created container with name as "project_id"-"deployment_id". Check with docker inspect "container name" that in Networks section there is a network with your defined name.
  23. hemangjoshi37a commented on Mar 4, 2023

    @hemangjoshi37a

    Has anyone solved this yet? I am still facing same issue with python function. Also there is no clear documenttaion or youtube video about this. may ber the code is broker in appwrite.

  24. garvitomer commented on Mar 5, 2023

    @garvitomer

    I am also facing the same issue since few months now. How to solve this error, it is such a critical bug? Can someone please help

  25. frenchmustard commented on Apr 11, 2023

    @frenchmustard

    For anyone who have this kind error as TC:

    An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 622bb6f3725e4422610e-622d226c1a20e10fc330

    In docker-compose.yml declared networks doesn't have specific names and when you up your containers from docker-compose it creates networks with template as "directory-name-of-compose-location"_"network-in-compose-file".

    So, in .env described network is hardcoded as _APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes which only work if your docker-compose.yml file located in appwrite directory.

    To avoid that do the next:

    1. Define specific network names in docker-compose.yml like this (be aware that they must be unique because of docker-host scope):
    ...
    networks:
      gateway:
        name: gateway
      appwrite:
        name: appwrite
      runtimes:
        name: runtimes
    ...
    1. Change .env and set your correct defined networks:
    ...
    _APP_EXECUTOR_RUNTIME_NETWORK=runtimes
    OPEN_RUNTIMES_NETWORK=runtimes
    ...
    1. Recreate containers for applying changes:
    docker-compose up -d
    
    1. Try to execute function from UI and after function execution you can find newly created container with name as "project_id"-"deployment_id". Check with docker inspect "container name" that in Networks section there is a network with your defined name.

    Tried this but doesn't solve it for me.

    Running AppWrite on DigitalOcean as a Droplet through the marketplace, didn't touch anytime except upload my code as .tar (followed the docs) but same error as the rest here. Sad because the rest looks really sleek.

  26. kecsot commented on Apr 21, 2023

    @kecsot

    Same. (1.3.1)

    We found a solution for our case, hope works for you
    appwrite functions createDeployment --functionId=YOUR_FID --entrypoint='src/index.php' --code="functions/Functionname" --activate=true

    Previously we got Internal Runtime error. When we just copied

    appwrite functions createDeployment \ 
        --functionId=644101c535550ab4ce99 \ 
        --entrypoint='index.php' \ 
        --code="." \ 
        --activate=true
    
  27. garvitomer commented on Apr 21, 2023

    @garvitomer

    I use this in CLI and it didn't work. I basically restart docker every day to minimize the error. No other solution yet 😞
    "$id": "......", "name": "orderMatchingAlgorithmFunction4", "runtime": "dart-2.17", "path": "functions/orderMatchingAlgorithmFunction4", "entrypoint": "lib/main.dart", "ignore": [".packages", ".dart_tool"], "execute": ["role:member"], "events": [], "schedule": "", "timeout": 15

  28. koyapo commented on Apr 24, 2023

    @koyapo

    still not working here too its pretty annoying ... im doing like u restarting server every days

  29. koyapo commented on Apr 25, 2023

    @koyapo

    @garvitomer do you use return when the response has to be sent in this way ? return res.json({
    'message': "hello",
    });

    @stnguyen90 doing this :
    return res.json({
    'message': "hello",
    });

    instead of :
    res.json({
    'message': "hello",
    });
    can have some side effect ?

  30. Alex-Fenner commented on Jul 24, 2023

    @Alex-Fenner

    I have run in to this issue working in an environment with no internet connectivity, and have got a workaround by removing the node-appwrite dependency and making all calls through the REST API. I assume that connectivity to internet is required to use the node-appwrite package? (I appreciate that this is a bit of an edge use case and ignores the issue)

  31. t0mm4rx commented on Aug 22, 2023

    @t0mm4rx

    I think this issue should be re-open as it could stilll happen during the 1.3.7 -> 1.3.8 migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions