
Hi π
After deploy a function, got this error: Could not resolve host: appwrite-executor with status code 0.

Where you getting this error exactly?

In dashboard...


π

Can you share this part of your code
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')

OK

Hmm..

import * as sdk from "node-appwrite";
type AppwriteVariables =
| "APPWRITE_FUNCTION_ENDPOINT"
| "APPWRITE_FUNCTION_API_KEY"
| "APPWRITE_FUNCTION_ID"
| "APPWRITE_FUNCTION_PROJECT_ID"
| "APPWRITE_FUNCTION_API_KEY";
type AppwriteRequest = {
headers: { [name: string]: string };
payload: string;
variables: { [key in AppwriteVariables]: string };
};
interface AppwriteResponse {
send: (data: string, status?: number) => {};
json: (data: object, status?: number) => {};
}
module.exports = async function (req: AppwriteRequest, res: AppwriteResponse) {
const client = new sdk.Client();
const users = new sdk.Users(client);
if (
!req.variables["APPWRITE_FUNCTION_ENDPOINT"] ||
!req.variables["APPWRITE_FUNCTION_API_KEY"]
) {
throw Error(
"Environment variables are not set. Function cannot use Appwrite SDK."
);
} else {
client
.setEndpoint(req.variables["APPWRITE_FUNCTION_ENDPOINT"])
.setProject(req.variables["APPWRITE_FUNCTION_PROJECT_ID"])
.setKey(req.variables["APPWRITE_FUNCTION_API_KEY"])
.setSelfSigned(true);
}
const getAllUsers = await users.list();
res.json({ message: getAllUsers.users });
};

I have set variables in functions settings (dashboad)

That seems good

And what value you've put inside this variable? APPWRITE_FUNCTION_ENDPOINT


When try activate i got this error


Is this a self-hosted Appwrite?

Yes

Can you run
docker ps -a
And share the results?

ok


Up 2 minutes ago beacuse updated .env file, added a dart runtimes

Okay so it seems like the appwrite-executor
has just been created
Can you try to execute your function now

It seems like it should work

Donβt work

Before this didnβt work, I changed the .env file because I had forgotten to add the runtime, but I tell you that it was no longer working.
Recommended threads
- OTP does not work on login page and user...
Hi there, Since updating from 1.6.2 to 1.7.3 the OTP function does not work anymore. I always get this error: ``` Invalid otp param: Value must be a valid str...
- Console is flooded with errors after upd...
Hi there, I ran 1.6.2 which worked great. I then used the migration guide to directly update to 1.7.3: https://appwrite.io/docs/advanced/self-hosting/update A...
- setup custom domain to appwrite but stil...
i just installed a Appwrite instance in my vps and i did all default otions exept the domain i have setuop its dns as A records pointing to my vps ip altho...
