Skip to content
Back

[SOLVED] Gitlab function automation

  • 0
  • Resolved
  • 2
  • Self Hosted
  • Functions
f4ls3
1 Feb, 2026, 02:12

Im trying to automate my function deployment using gitlabs ci/cd pipeline. Im currently failing trying to use the appwrite cli to create a new deployment.

⁨``` appwrite functions create-deployment --function-id $FUNCTION_ID --code "." --entrypoint "dist/main.js" --commands "npm i -g typescript && npm install && tsc" --activate true

TypeScript

No matter how I change the --code parameter I cannot get this command to work even when trying to execute it myself and not in the pipeline:

```
Error: File not found in payload
    at _Client.<anonymous> (C:\Users\***\AppData\Roaming\npm\node_modules\appwrite-cli\dist\cli.cjs:110410:15)
    at Generator.next (<anonymous>)
    at C:\Users\***\AppData\Roaming\npm\node_modules\appwrite-cli\dist\cli.cjs:109848:67
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\***\AppData\Roaming\npm\node_modules\appwrite-cli\dist\cli.cjs:109830:10)
    at _Client.chunkedUpload (C:\Users\***\AppData\Roaming\npm\node_modules\appwrite-cli\dist\cli.cjs:110407:12)
    at Functions.createDeployment (C:\Users\***\AppData\Roaming\npm\node_modules\appwrite-cli\dist\cli.cjs:116010:24)
    at C:\Users\***\AppData\Roaming\npm\node_modules\appwrite-cli\dist\cli.cjs:143588:111
```
What does that error mean? Is it even related to the --code parameter?
TL;DR
Gitlab function automation troubleshooting with Appwrite CLI commands and JSON configurations. Solution involves setting Gitlab CI/CD variables and using an `appwrite.config.json` file. Deployment issue resolved by re-running deploy stage.
2 Feb, 2026, 12:39

Any help on this?

2 Feb, 2026, 13:47

have you tried using an appwrite.json file and appwrite push functions -f <function-id>

2 Feb, 2026, 16:41

do i put the appwrite.json in the root of my repo for it to work? what exactly do I need to have inside the appwrite.json?

2 Feb, 2026, 17:02

but still even if using a json file works shouldnt the create-deployment one work?

2 Feb, 2026, 17:03

and I've noticed that the push command requires an input after executing which is very bad for automating

2 Feb, 2026, 17:06

if you give it the params it needs it doesn't do the interactive cli part

2 Feb, 2026, 17:06

no it still does

2 Feb, 2026, 17:06

it asks if i want it to create a deployment

2 Feb, 2026, 17:07

why isnt the --force option listed in the help?

2 Feb, 2026, 17:36

couldn't tell ya /:

2 Feb, 2026, 17:37

well ty anyway it worked

2 Feb, 2026, 17:38

just messing around with typescript now to get the function to actually function

2 Feb, 2026, 19:46

For anyone wanting to do this in the future: ⁨```yaml stages:

  • build
  • deploy

build-function: stage: build image: node:lts-alpine only: - main script: - npm install -g typescript - npm install - tsc artifacts: paths: - dist/ - package.json - appwrite.config.json expire_in: 1 hour

deploy-function: stage: deploy image: node:lts-alpine dependencies: - build-function only: - main before_script: - npm install -g appwrite-cli - appwrite client --endpoint $APPWRITE_ENDPOINT --project-id $APPWRITE_PROJECT_ID --key $APPWRITE_API_KEY script: - appwrite push function --function-id $FUNCTION_ID --force ```⁩

1
2 Feb, 2026, 19:48

You have to set all the variables in your gitlab instance/repo ci/cd variables as well as have a ⁨appwrite.config.json⁩ containing the following:

⁨```json { "functions": [ { "$id": "<Function Id here>", "name": "<Function Name Here>", "runtime": "node-16.0", "specification": "s-1vcpu-512mb", "execute": [], "scopes": [], "events": [], "schedule": "", "timeout": 15, "enabled": true, "logging": true, "entrypoint": "dist/main.js", "commands": "npm install", "ignore": ["node_modules", ".npm"], "path": "." } ] }

TypeScript

(you may need to tweak some of the values to your specific function)
1
2 Feb, 2026, 19:48

[SOLVED] Gitlab function automation

2 Feb, 2026, 22:28

Edit: when running the ci/cd pipeline when the function has not yet been created in the appwrite console, the deploy-function job will be marked as successful but will not actually have pushed the function. just re-run the deploy stage and it will work without issue on all future jobs

2 Feb, 2026, 22:29
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