Back

Can't execute functions

  • 0
  • Self Hosted
  • Functions
  • Web
turndude
29 Feb, 2024, 14:14

Hello, I already added this to a comment in the functions domains post, but since it seems unrelated I'll create a proper topic here.

I get an error when trying to execute any function, "An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 65e07b00bbed8\nError Code: 500" where the alphanumeric changes for each execution..

in the executor log i get the following: "Type: Exception" "Message: An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 65e07f5d88add" "File: /usr/local/app/http.php" "Line: 1021"

I'm wondering if anyone knows where I should start looking to figure this one out? 🤷‍♂️ I have Appwrite version Version 1.4.13, running through coolify.

I have tried creating the function through CLI and github, both fail in the same way.

TL;DR
Developers are experiencing an error when trying to execute functions, getting an internal curl error. The issue seems to be linked to using an incorrect version of the appwrite SDK. By updating the SDK version in the package.json file to 11.1.1, the problem can potentially be resolved. Additionally, there are discussions regarding DNS setup and custom domain configurations in the appwrite environment. It is suggested to check and correct environment variables and make sure they are set up correctly. There are also tips on adjusting domain settings and resolving internal curl errors.
turndude
1 Mar, 2024, 14:11

Ah, I should probably update the compose here, I used the default one produced by coolify this time around, the one I posted earlier was the standard one I found on the appwrite homepage, but it didn't play too nice with the coolify setup, this is the current one:

turndude
1 Mar, 2024, 14:11
turndude
1 Mar, 2024, 14:18

hmm, it seems they use traefik to reverse proxy resources created. https://coolify.io/docs/servers

turndude
1 Mar, 2024, 14:26

Just to make sure, I created a function in node, ruby, php and python, and they all have the same issue 🙂

fafa
1 Mar, 2024, 14:28

Yeah something is going wrong within appwrite, which is pretty weird

fafa
1 Mar, 2024, 14:28

What did you do after changing the .env?

turndude
1 Mar, 2024, 14:30

ah, so I don't actually change the env directly; I just changed the env variables in coolify, and it compiles a new .env as far as I understand 🙂

Haven't really done much more than clean up and restarted appwrite after that 🙂

fafa
1 Mar, 2024, 14:31

I'm kind of unsure how coolify works, so I cannot help you that well with that

turndude
1 Mar, 2024, 14:34

Totally fair 😅 I posted about this in their discord as well, but no response so far

D5
1 Mar, 2024, 14:35

What are the logs for docker compose logs openruntimes-executor?

turndude
1 Mar, 2024, 14:37
turndude
1 Mar, 2024, 14:38

ah, I ran the function again now, and did a new readout:

turndude
1 Mar, 2024, 14:38
D5
1 Mar, 2024, 15:11

What's the function code?

turndude
1 Mar, 2024, 15:20
TypeScript
import { Client } from 'node-appwrite';

// This is your Appwrite function
// It's executed each time we get a request
export default async ({ req, res, log, error }) => {
  // Why not try the Appwrite SDK?
  //
  // const client = new Client()
  //   .setEndpoint('https://cloud.appwrite.io/v1')
  //   .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
  //   .setKey(process.env.APPWRITE_API_KEY);

  // You can log messages to the console
  log('Hello, Logs!');

  // If something goes wrong, log an error
  error('Hello, Errors!');

  // The `req` object contains the request data
  if (req.method === 'GET') {
    // Send a response with the res object helpers
    // `res.send()` dispatches a string back to the client
    return res.send('Hello, World!');
  }

  // `res.json()` is a handy helper for sending JSON
  return res.json({
    motto: 'Build like a team of hundreds_',
    learn: 'https://appwrite.io/docs',
    connect: 'https://appwrite.io/discord',
    getInspired: 'https://builtwith.appwrite.io',
  });
};
turndude
1 Mar, 2024, 15:21

package.json:

TypeScript
{
  "name": "starter-template",
  "version": "1.0.0",
  "description": "",
  "main": "src/main.js",
  "type": "module",
  "scripts": {
    "format": "prettier --write ."
  },
  "dependencies": {
    "node-appwrite": "^9.0.0"
  },
  "devDependencies": {
    "prettier": "^3.0.0"
  }
}
fafa
1 Mar, 2024, 16:28

weird

D5
1 Mar, 2024, 19:54

Looks like you're using an incorrect appwrite SDK version. Try with 11.1.1

D5
1 Mar, 2024, 19:55

So change "node-appwrite": "^9.0.0" To "node-appwrite": "^11.1.1"

turndude
1 Mar, 2024, 20:38

hmm, I updated the package.json, and ran npm install just to be sure, then deployed the function; but still got the same error :/ "An internal curl error has occurred within the executor! Error Msg: Could not resolve host: 65e23c46a33bf\nError Code: 500"

package.json:

TypeScript
{
  "name": "starter-template",
  "version": "1.0.0",
  "description": "",
  "main": "src/main.js",
  "type": "module",
  "scripts": {
    "format": "prettier --write ."
  },
  "dependencies": {
    "node-appwrite": "^11.1.1"
  },
  "devDependencies": {
    "prettier": "^3.0.0"
  }
}
turndude
1 Mar, 2024, 20:41

just to check, I don't need any Environment variables on the function it self for it to be able to run? The ones in the picture I mean.

D5
1 Mar, 2024, 20:45

Do you get any different error in logs?

turndude
1 Mar, 2024, 20:51

Here are the logs now, I think it's the same

D5
1 Mar, 2024, 21:00

What are the server specs?

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