Back

[SOLVED] Cloud Function - Deployment failed

  • 0
  • Functions
hamed
22 Feb, 2023, 16:37

First of all there's no error in my function codes ,it was working fine on the previous appwrite version , this issue happened when i update appwrite last night: Whenever i create a deployment within CLI its just failed to build after 15-22 seconds, (I also tried the starter appwrite fucntion code.) Hopefully someone could help.

TL;DR
Issue: Cloud Function deployment fails after updating Appwrite Error: Docker Error: Killed Possible solution: 1. Check if the memory limits for the function are set properly in the .env file. 2. Increase the values of _APP_FUNCTIONS_MEMORY and _APP_FUNCTIONS_MEMORY_SWAP environment variables. 3. Run the command "docker compose exec appwrite vars" to verify the values of the environment variables. 4. Check if there is enough RAM available on the server. 5. If running on a VPS, ensure sufficient RAM for Appwrite and functions. 6. Check the logs of the appwrite-executor docker instance for more
SenZi
22 Feb, 2023, 17:04

Did you check the logs of your appwrite-executor docker instance? That usually seem to give some information when a build fails or times out.

hamed
22 Feb, 2023, 17:08

kind of , but its not clear to me:

TypeScript
2023-02-22 16:22:19 Docker Error: Killed
2023-02-22 16:22:19 Resolving dependencies...
2023-02-22 16:22:19 + collection 1.17.0 (1.17.1 available)
2023-02-22 16:22:19 + matcher 0.12.12 (0.12.14 available)
2023-02-22 16:22:19 + meta 1.9.0
2023-02-22 16:22:19 + path 1.8.3
2023-02-22 16:22:19 + pub_semver 2.1.3
2023-02-22 16:22:19 + pubspec 2.3.0
2023-02-22 16:22:19 + quiver 3.2.1
2023-02-22 16:22:19 + source_span 1.9.1
2023-02-22 16:22:19 + stack_trace 1.10.0 (1.11.0 available)
2023-02-22 16:22:19 + string_scanner 1.1.1 (1.2.0 available)
2023-02-22 16:22:19 + term_glyph 1.2.1
2023-02-22 16:22:19 + uri 1.0.0
2023-02-22 16:22:19 + yaml 3.1.1
2023-02-22 16:22:19 Downloading pubspec 2.3.0...
2023-02-22 16:22:19 Downloading uri 1.0.0...
2023-02-22 16:22:19 Downloading yaml 3.1.1...
2023-02-22 16:22:19 Downloading string_scanner 1.1.1...
2023-02-22 16:22:19 Downloading path 1.8.3...
2023-02-22 16:22:19 Downloading collection 1.17.0...
2023-02-22 16:22:19 Downloading pub_semver 2.1.3...
2023-02-22 16:22:19 Downloading quiver 3.2.1...
2023-02-22 16:22:19 Downloading matcher 0.12.12...
2023-02-22 16:22:19 Downloading stack_trace 1.10.0...
2023-02-22 16:22:19 Downloading source_span 1.9.1...
2023-02-22 16:22:19 Downloading term_glyph 1.2.1...
2023-02-22 16:22:19 Downloading meta 1.9.0...
2023-02-22 16:22:19 Changed 13 dependencies!
SenZi
22 Feb, 2023, 17:10

Which environment are you using?

hamed
22 Feb, 2023, 17:11

dart?

SenZi
22 Feb, 2023, 17:13

It seems like your docker instance is being killed. Probably running out of memory, did you set functions memory limit using the _APP_FUNCTIONS_MEMORY env variable? or maybe try providing some swap memory

hamed
22 Feb, 2023, 17:17

No, it's all set to the default value. haven't mess with them at all.

SenZi
22 Feb, 2023, 17:17

Are you using a vps? is there enough ram for appwrite and functions?

hamed
22 Feb, 2023, 17:19

Im running it locally, i have 8g ram ,docker used 3.5 i think so there's no lack of memory

Drake
22 Feb, 2023, 17:26

You might want to increase the following environment variables:

TypeScript
_APP_FUNCTIONS_MEMORY
_APP_FUNCTIONS_MEMORY_SWAP

See https://appwrite.io/docs/environment-variables#functions for more info

hamed
22 Feb, 2023, 17:35

Hmm i see but im confused, in the documentation it said:

TypeScript
The default value is empty. When it's empty, memory limit will be disabled.

Why i need to increase them. Besides in my .env their values are 0.

Drake
22 Feb, 2023, 17:43

What's the output of:

TypeScript
docker compose exec appwrite vars | grep MEMORY
hamed
22 Feb, 2023, 17:47

command not recognized.

Drake
22 Feb, 2023, 17:48

docker compose version doesn't work for you?

hamed
22 Feb, 2023, 17:49

docker compose version it worked

Drake
22 Feb, 2023, 17:50

where are you running this? are you on a unix server? what exactly is your error?

hamed
22 Feb, 2023, 17:51

This one worked docker compose exec appwrite vars Output:

TypeScript
- _APP_STORAGE_WASABI_REGION=eu-central-1
- _APP_STORAGE_WASABI_BUCKET=
- _APP_FUNCTIONS_SIZE_LIMIT=30000000
- _APP_FUNCTIONS_TIMEOUT=900
- _APP_FUNCTIONS_BUILD_TIMEOUT=900
- _APP_FUNCTIONS_CONTAINERS=10
- _APP_FUNCTIONS_CPUS=1
- _APP_FUNCTIONS_MEMORY=128
- _APP_FUNCTIONS_MEMORY_SWAP=128
- _APP_FUNCTIONS_RUNTIMES=dart-2.17
- _APP_EXECUTOR_SECRET=your-secret-key
- _APP_EXECUTOR_HOST=http://appwrite-executor/v1
- _APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
- _APP_FUNCTIONS_ENVS=
- _APP_FUNCTIONS_INACTIVE_THRESHOLD=
- DOCKERHUB_PULL_USERNAME=
- DOCKERHUB_PULL_PASSWORD=
- DOCKERHUB_PULL_EMAIL=
- OPEN_RUNTIMES_NETWORK=
- _APP_MAINTENANCE_INTERVAL=86400
- _APP_MAINTENANCE_RETENTION_CACHE=2592000
- _APP_MAINTENANCE_RETENTION_EXECUTION=1209600
- _APP_MAINTENANCE_RETENTION_AUDIT=1209600
- _APP_MAINTENANCE_RETENTION_ABUSE=86400
- _APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000
- _APP_GRAPHQL_MAX_BATCH_SIZE=10
- _APP_GRAPHQL_MAX_COMPLEXITY=250
- _APP_GRAPHQL_MAX_DEPTH=
Drake
22 Feb, 2023, 17:52

so as you can see, you have memory set to:

TypeScript
- _APP_FUNCTIONS_MEMORY=128
- _APP_FUNCTIONS_MEMORY_SWAP=128

The docker image itself has the values set to 128. You can try setting it to 0 in your .env file or some bigger value

hamed
22 Feb, 2023, 17:55

Why they are different? in .env _APP_FUNCTIONS_MEMORY=0 _APP_FUNCTIONS_MEMORY_SWAP=0

Drake
22 Feb, 2023, 18:12

is it listed in the environment section of the appwrite container? If it is, maybe you changed it, but never recreated the containers

hamed
22 Feb, 2023, 18:14

Uhh i see,

hamed
22 Feb, 2023, 18:15

[SOLVED] Cloud Function - Deployment failed

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