#[Solved] Error: Appwrite-executor with status code 0
145 messages · Page 1 of 1 (latest)
Where you getting this error exactly?
👍
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
Is this a self-hosted Appwrite?
Yes
Can you run
docker ps -a
And share the results?
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.
Ohh so now the appwrite-executor is on or off?
What error you're getting, the same one?
Same error
And this?
Anyone can help?
As the executor wasn't available at start
I'll first try to run
docker compose down && docker compose up -d
To let the infrastructure restart
Good.
Now what you get when executing the function
What is the error?
The same
And the Appwrite logs?
Where you see that error?
What the error means is that the executor is not available which is weird as saw the executor is one here
#1131572694496854076 message
Maybe you've changed this value
OPEN_RUNTIMES_NETWORK=?
In the .env file?
Don't changes...
[
{
"Name": "appwrite_runtimes",
"Id": "05cbe3e51f357a74c3638ae939925c97f5b07a578d7037c0e8327946bd0cce90",
"Created": "2023-07-20T15:00:24.558536332Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.21.0.0/16",
"Gateway": "172.21.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"a9bf5817acb21849d6c1099a7d86416a711f1badfd268d9642f88c8635b12783": {
"Name": "appwrite-executor",
"EndpointID": "1fa419f95e364e052c2635c8f199962e0e23c863999efdd15bda06ff2968ca95",
"MacAddress": "02:42:ac:15:00:02",
"IPv4Address": "172.21.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "runtimes",
"com.docker.compose.project": "appwrite",
"com.docker.compose.version": "2.19.1"
}
}
]
Also I meant this one _APP_EXECUTOR_RUNTIME_NETWORK
Okay this intersting
As you don't have the function in the network
What it the output of
docker network ls
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
NETWORK ID NAME DRIVER SCOPE
bc57358c6cd2 appwrite_appwrite bridge local
40187ebe9870 appwrite_gateway bridge local
05cbe3e51f35 appwrite_runtimes bridge local
827dbb8bc08d bridge bridge local
62edf67b02e3 host host local
a3b5419aaa62 none null local
Okay can you share the networks part of your appwrite-executor service inside the docker-compose.yml like so:
appwrite-executor:
image: appwrite/appwrite:1.3.7
entrypoint: executor
<<: *x-logging
container_name: appwrite-executor
restart: unless-stopped
stop_signal: SIGINT
networks:
...
ok
appwrite-executor:
image: appwrite/appwrite:1.3.7
entrypoint: executor
<<: *x-logging
container_name: appwrite-executor
restart: unless-stopped
stop_signal: SIGINT
networks:
appwrite:
runtimes:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- appwrite-functions:/storage/functions:rw
- appwrite-builds:/storage/builds:rw
- /tmp:/tmp:rw
depends_on:
- redis
- mariadb
- appwrite
environment:
- _APP_ENV
- _APP_VERSION
- _APP_FUNCTIONS_TIMEOUT
- _APP_FUNCTIONS_BUILD_TIMEOUT
- _APP_FUNCTIONS_CONTAINERS
- _APP_FUNCTIONS_RUNTIMES
- _APP_FUNCTIONS_CPUS
- _APP_FUNCTIONS_MEMORY
- _APP_FUNCTIONS_MEMORY_SWAP
- _APP_FUNCTIONS_INACTIVE_THRESHOLD
- _APP_EXECUTOR_SECRET
- OPEN_RUNTIMES_NETWORK
- _APP_LOGGING_PROVIDER
- _APP_LOGGING_CONFIG
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
- _APP_STORAGE_DO_SPACES_BUCKET
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
- _APP_STORAGE_BACKBLAZE_SECRET
- _APP_STORAGE_BACKBLAZE_REGION
- _APP_STORAGE_BACKBLAZE_BUCKET
- _APP_STORAGE_LINODE_ACCESS_KEY
- _APP_STORAGE_LINODE_SECRET
- _APP_STORAGE_LINODE_REGION
- _APP_STORAGE_LINODE_BUCKET
- _APP_STORAGE_WASABI_ACCESS_KEY
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- DOCKERHUB_PULL_USERNAME
- DOCKERHUB_PULL_PASSWORD
It's weird as the containers are on the same network
What is the value of _APP_EXECUTOR_HOST inside the .env file?
_APP_EXECUTOR_HOST=http://appwrite-executor/v1
Then everything in order and it should work
I guess will need to wait for Steven diagnostic on this matter.
No no
Let's say you run
docker exec -it appwrite sh
To enter the Appwrite container
And then you run
ping appwrite-executor
Do you get an answer?
Ohhhhh
Sorry
Can you redeploy the function again?
From the CLI
In the first deployment the appwrite-executor wasn't available, but now it is so it should work.
Ok, I’ll try now.
ping: bad address 'appwrite-executor'
Interesting
It means there aren't connected to each other.
Redeploy solved anything?
Redeploy don't work..
Building... failed
Same error
So, there is a real trouble between the connection of the main container to the executor one.
As the ping didn't work
And both of the containers are up and running.
Hmm
I don't know what to do... I've never had so many problems with Appwrite as I do now, I've been using it since the first version, then going back to using it with the launch of database relationships, so since then I've been having headaches.
😥
Yes, that's a bummer
Have you run the migrate script after each upgrade?
I don't have problems with migration, I usually do a new installation for each new project.
So let's try to retrack the steps
What values you have changes, if any in thes files
- docker-compose.yml
- .env
Then I create a new instance, create the server in manual mode.
Don't touch in docker-compose..
Env file only changes all field related how email, host secret-key
Ahh... and force to use HTTPS
Something is not right with the docker networks
We can try one more thing that will reload the whole docker infrastructure
- Reboot the server
- Run
docker psto see that all the services are up and running - Redeploying the function
- the instance?
Yes
What are the results of this command
docker network inspect appwrite_appwrite --format '{{range .Containers}}{{println .Name .IPv4Address println }}{{end}}'
appwrite-mariadb 172.23.0.5/16
ok
appwrite 172.23.0.20/16
appwrite-redis 172.23.0.4/16
appwrite-schedule 172.23.0.13/16
appwrite-worker-audits 172.23.0.7/16
appwrite-influxdb 172.23.0.6/16
appwrite-worker-databases 172.23.0.17/16
appwrite-telegraf 172.23.0.3/16
appwrite-worker-certificates 172.23.0.9/16
appwrite-maintenance 172.23.0.18/16
appwrite-worker-webhooks 172.23.0.10/16
appwrite-worker-messaging 172.23.0.14/16
appwrite-worker-mails 172.23.0.19/16
appwrite-realtime 172.23.0.11/16
appwrite-worker-deletes 172.23.0.8/16
appwrite-mariadb 172.23.0.5/16
appwrite-worker-builds 172.23.0.16/16
appwrite-usage 172.23.0.15/16
appwrite-worker-functions 172.23.0.12/16
appwrite-traefik 172.23.0.2/16
The executor is not connected to that network 🤔
That’s what I was watching, he doesn’t appear on the list.
The docker-compose file isn't really matter
Maybe it's worth a try to rerun it
$# docker compose down
$# mv docker-compose.yml docker-compose.yml.old
$# curl https://appwrite.io/install/compose -o docker-compose.yml
$# docker compose up -d
$# docker network inspect appwrite_appwrite --format '{{range .Containers}}{{println .Name .IPv4Address }}{{end}}' | grep executor
appwrite-executor 172.19.0.19/16
You can, download these two versions of docker-compose.yml file and compere to see what change caused the issue.
OKi
Let us know
It has the same number of lines, 674 both
Maybe some extra space?
Checking...
Downloading old docker-compose file from server
Hmmm
Doing an improved audit... I found differences.
Good
What are they
The compose file from appwrite url have:
18799 characteres and 674 lines..
The old compose file from me server have:
18127 characteres and 675 lines
Hmm
At the end of the file there is an extra line
An extra space.
This is cause te problem?
not really
[Solved] Error: Appwrite-executor with status code 0
Hmm, I compared the files and only found this extra line with space.
Now it’s working, thank you again @analog token 😊
Ops kkkk need change a language