Skip to content
Back

[SOLVED] Unable to push function from API KEY with CLI

  • 0
  • Resolved
  • 2
  • Functions
9 Jul, 2026, 11:51

When trying to push functions from Gitlab CI (with an API KEY and using the CLI), i saw that i was unable to push functions.

TypeScript
$ appwrite client --endpoint $APPWRITE_ENDPOINT --project-id $APPWRITE_PROJECT_ID --key $APPWRITE_API_KEY
Success: Client configuration updated
$ appwrite push functions --function-id $APPWRITE_FUNCTION_ID --force --activate true
Info: Validating functions ...
Info: Checking for changes ...
Info: Pushing functions ...
Info: For detailed error pass the --verbose or --report flag
Error: Session not found. Please run `appwrite login` to create a session

Is it something that you stopped supporing or is it a bug ?

Looking at the code, it seams like the push function uses the ConsoleService for checking proxies rules :

TL;DR
User found a solution by using the API first before falling back to hardcoded defaults. This resolved the issue of being unable to push functions from API KEY with CLI.
9 Jul, 2026, 11:53

As a fix, maybe :

  • when pushing functions/site to add an option for the proxy part (like a --with-proxies)
  • just skip that proxy part if it's an API KEY
  • or since i saw in the console, that the API keys have proxy scopes, to fix it and don't use the ConsoleService
9 Jul, 2026, 13:04

as a current workaround i'm using the login with totp :

TypeScript
$ npm i -g totp-client
$ export TOTP=$(totp-client generate $APPWRITE_TOTP_SECRET | sed -n 's/.*TOTP Code: \([0-9]*\).*/\1/p') && echo $TOTP
XXXXXX
$ appwrite login --endpoint $APPWRITE_ENDPOINT --email $APPWRITE_EMAIL --password $APPWRITE_PASSWORD --mfa totp --code $TOTP
Success: Successfully signed in as ibaraki@example.Com
Hint: Next you can create or link to your project using 'appwrite init project'
$ appwrite push functions --function-id $APPWRITE_FUNCTION_ID --force --activate true
Info: Validating functions ...
Info: Checking for changes ...
Info: Pushing functions ...
........
Success: Successfully deployed 1 function in 50.4s.
9 Jul, 2026, 13:12

it's just annoying cuz every publish i get an email warning me about a new sessions xdd

9 Jul, 2026, 14:40

taking a look

9 Jul, 2026, 16:42

saw it was merged and deployed, i'm testing

9 Jul, 2026, 16:50

sadly still not working

9 Jul, 2026, 16:53

it's more like the push command constructor have the console that needs session and is used in places where it should be key only

10 Jul, 2026, 02:49
10 Jul, 2026, 08:39

oh ok ok, iirc i saw it in the 22.5.0 release note but might be wrong

10 Jul, 2026, 08:40

Also, it's now working

TypeScript
$ appwrite client --endpoint $APPWRITE_ENDPOINT --project-id $APPWRITE_PROJECT_ID --key $APPWRITE_API_KEY
Success: Client configuration updated
$ appwrite push functions --function-id $APPWRITE_FUNCTION_ID --force --activate true
Info: Validating functions ...
Info: Checking for changes ...
Info: Pushing functions ...
PushingTemplate (688373db001c98838edf)          • Ignoring using: appwrite.config.json
DeployingTemplate (688373db001c98838edf)          • Status: waiting
DeployingTemplate (688373db001c98838edf)          • Status: building
Build logs
DeployingTemplate (688373db001c98838edf)          • Status: building
DeployingTemplate (688373db001c98838edf)          • Status: building
DeployingTemplate (688373db001c98838edf)          • Status: building
DeployingTemplate (688373db001c98838edf)          • Status: building
DeployingTemplate (688373db001c98838edf)          • Status: building
DeployingTemplate (688373db001c98838edf)          • Status: building
DeployedTemplate (688373db001c98838edf)           
Info: Preview link: https://6a4f82fa0015e9b31ca3.appwrite.example.com
Info: Deployment page: https://appwrite.example.com/console/project-688228a50003cf2546fa/functions/function-688373db001c98838edf/deployment-6a50af6fc2c21b17a951
Success: Successfully deployed 1 function in 49.7s.
10 Jul, 2026, 08:46

noice

10 Jul, 2026, 08:52

putting it as solved

10 Jul, 2026, 08:52

[SOLVED] Unable to push function from API KEY with CLI

10 Jul, 2026, 10:13

also when pushing, the Deployment page URL use project-688228a50003cf2546fa tho the console use regions so it should be project-default-688228a50003cf2546fa instead

since i don't use that URL i don't really care, but for others that could be nice to fix it

10 Jul, 2026, 10:22

ur using self hosted?

10 Jul, 2026, 10:22

yes (that's why it's using default and not a real region)

10 Jul, 2026, 10:23

yep yep makes sense

10 Jul, 2026, 10:23

noted

10 Jul, 2026, 10:27

i swear it used to be just project-${projectId} for self hosted, there is logic for it

10 Jul, 2026, 10:27

ig it changed with 1.9.5?

10 Jul, 2026, 10:29

no it was already the case since the cloud regions so something like 1.8.0.

i also remember needing a console patch because the console didn't support region when the API did

10 Jul, 2026, 10:31

for example, the "/v1/account/prefs" return this, so with the region

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