Giter Site home page Giter Site logo

sdk-for-cli's Introduction

Appwrite Command Line SDK

License Version Build Status Twitter Account Discord

This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check previous releases.

Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs

Appwrite

Installation

The Appwrite CLI is a Node based command line tool to help you interact with the Appwrite API. The CLI is distributed both as an npm package as well as pre built binaries for specific operating systems and architectures.

Install using NPM


If you have npm installed, it's as easy as running

$ npm install -g appwrite-cli

Once the installation is complete, you can verify the install using

$ appwrite -v
5.0.5

Install using prebuilt binaries


If you do not have npm installed, you can always install the prebuilt binaries for your architecture and OS using our convenient installation scripts.

Linux / MacOS Terminal

$ wget -q https://appwrite.io/cli/install.sh  -O - | /bin/bash

MacOS via Homebrew

$ brew install appwrite 

Windows

Via Powershell

$ iwr -useb https://appwrite.io/cli/install.ps1 | iex

Via Scoop

$ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/scoop/appwrite.json

Once the installation completes, you can verify your install using

$ appwrite -v
5.0.5

Getting Started

Before you can use the CLI, you need to login to your Appwrite account.

$ appwrite login

? Enter your email [email protected]
? Enter your password ********
✓ Success 

This will also prompt you to enter your Appwrite endpoint ( default: http://localhost/v1 )

  • Initialising your project

Once logged in, the CLI needs to be initialised before you can use it with your Appwrite project. You can do this with the appwrite init project command.

$ appwrite init project

The following prompt will guide you through the setup process. The init command also creates an appwrite.json file representing your Appwrite project.

The appwrite.json file does a lot of things.

  • Provides context to the CLI
  • Keeps track of all your cloud functions
  • Keeps track of all your project's collections
  • Helps you deploy your Appwrite project to production and more..

You can also fetch all the collections in your current project using

appwrite init collection
  • Creating and deploying cloud functions

The CLI makes it extremely easy to create and deploy Appwrite's cloud functions. Initialise your new function using

$ appwrite init function
? What would you like to name your function? My Awesome Function
? What runtime would you like to use? Node.js (node-15.5)
✓ Success 

This will create a new function My Awesome Function in your current Appwrite project and also create a template function for you to get started.

$ tree My\ Awesome\ Function 

My Awesome Function
├── README.md
├── index.js
├── package-lock.json
└── package.json

0 directories, 4 files

You can now deploy this function using

$ appwrite deploy function

? Which functions would you like to deploy? My Awesome Function (61d1a4c81dfcd95bc834)
ℹ Info Deploying function My Awesome Function ( 61d1a4c81dfcd95bc834 )
✓ Success Deployed My Awesome Function ( 61d1a4c81dfcd95bc834 )

Your function has now been deployed on your Appwrite server! As soon as the build process is finished, you can start executing the function.

  • Deploying Collections

Similarly, you can deploy all your collections to your Appwrite server using

appwrite deploy collections

Note

By default, requests to domains with self signed SSL certificates (or no certificates) are disabled. If you trust the domain, you can bypass the certificate validation using

$ appwrite client --selfSigned true

Usage

The Appwrite CLI follows the following general syntax.

$ appwrite [COMMAND] --[OPTIONS]

A few sample commands to get you started

$ appwrite users create --userId "unique()" --email [email protected] --password very_strong_password
$ appwrite users list 

To create a document you can use the following command

$ appwrite database createDocument --collectionId <ID> --documentId 'unique()' --data '{ "Name": "Iron Man" }' --permissions 'read("any")' 'read("team:abc")'

Some Gotchas

  • data must be a valid JSON string where each key and value are enclosed in double quotes " like the example above.
  • Some arguments like the read and write permissions are expected to be arrays. In the Appwrite CLI, array values are passed in using space as a separator like in the example above.

To get information about the different services available, you can use

$ appwrite -h

To get information about a particular service and the commands available in a service you can use

$ appwrite users // or
$ appwrite users --help // or
$ appwrite users help // or
$ appwrite accounts

To get information about a particular command and the parameters it accepts, you can use

$ appwrite users list --help
$ appwrite account get --help 

At any point, you can view or reset the CLI configuration using the client service.

$ appwrite client --debug
// This will display your endpoint, projectID, API key and so on.
$ appwrite client --reset

CI mode

The Appwrite CLI can also work in a CI environment. The initialisation of the CLI works a bit differently in CI. In CI, you set your endpoint, projectId and API Key using

appwrite client --endpoint http://localhost/v1 --projectId <PROJECT_ID> --key <API KEY>

Contribution

This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.

To build and test the CLI for development, follow these steps

  1. Clone the SDK Generator repository and cd into the directory
$ git clone https://github.com/appwrite/sdk-generator
$ cd sdk-generator
  1. Ensure Docker is running locally and then install the composer dependencies using
$ docker run --rm --interactive --tty --volume "$(pwd)":/app composer install --ignore-platform-reqs --optimize-autoloader --no-plugins --no-scripts --prefer-dist

# Generate the SDKs
$ docker run --rm -v $(pwd):/app -w /app php:8.1-cli php example.php
  1. Head over to the generated SDK and install the dependencies.
$ cd examples/cli
$ npm install 
  1. Install the CLI using
$ npm install -g .
  1. You can now use the CLI
$ appwrite -v

License

Please see the BSD-3-Clause license file for more information.

sdk-for-cli's People

Contributors

abnegate avatar abxhr avatar christyjacob4 avatar eldadfux avatar evdog4life avatar lohanidamodar avatar loks0n avatar lucasmichot avatar meldiron avatar pineappleionic avatar stnguyen90 avatar torstendittmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk-for-cli's Issues

🐛 Bug Report: Variables aren't Deployed on 1st Function Deployment

👟 Reproduction steps

When I try to deploy a function for the first time using "appwrite deploy function", the CLI does not deploy the variables that are located in the appwrite.json for that function. Running "appwrite deploy" function again causes the variables to show up in the console.

👍 Expected behavior

It should create the function's variable even during the initial function deployment.

👎 Actual Behavior

It does not create the variables on the first run of "appwrite deploy function"

🎲 Appwrite version

Version 1.0.x

💻 Operating system

Windows

🧱 Your Environment

appwrite -v => 1.1.1

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Feature: Adding Scoop support to appwrite

Scoop is a package manager for windows allowing for easy installation of packages via a JSON manifest file. This is achieved by either having the manifest as part of a bucket or by providing a direct link to it. It would be nice to have a functioning manifest hosted in the github repository to allow anyone to install it via scoop while it has not yet been added to the main bucket.

Things needed for the appwrite cli to be installable with scoop:

  • Working manifest file allowing installation via url
  • Hashes within the manifest to allow for verification of the binary on the client side
  • PR to add the appwrite manifest to the main bucket in the scoop org

Documentation should also be added to make it easily visible to anyone wanting to install it via alternate methods.

Upgrade our issue templates to use GitHub issue forms ✍️

Introduction

GitHub has recently rolled out a public beta for their issue forms feature. This would allow you to create interactive issue templates and validate them 🤯.

Appwrite currently uses the older issue template format. Your task is to create GitHub issue forms for this repository. Please use Appwrite's issue templates as a reference for this PR.

Tasks summary:

  • Fork & clone this repository
  • Prepare bug report issue form in .github/ISSUE_TEMPLATE/bug.yaml
  • Prepare documentation issue form in .github/ISSUE_TEMPLATE/documentation.yaml
  • Prepare feature request issue form in .github/ISSUE_TEMPLATE/feature.yaml
  • Push changes to master and test issue forms on your fork
  • Submit pull request

If you need any help, reach out to us on our Discord server.

Are you ready to work on this issue? 🤔 Let us know, and we will assign it to you 😊

Happy Appwriting!

🐛 Bug Report: appwrite client command fails with https host

👟 Reproduction steps

When I try to set an https host via the appwrite cli, it fails with the following error:

$ sudo appwrite client --endpoint https://localhost/v1 --verbose --debug --selfSigned true
[sudo] password for sandyseagull: 
endpoint : 
key : 
cookie : 
selfSigned : false
project
projectId : 632ad032e0f1c3f8bb2d
projectName : testProject
Error: Invalid endpoint or your Appwrite server is not running as expected.
    at /usr/local/lib/node_modules/appwrite-cli/lib/commands/generic.js:81:23
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
✗ Error Invalid endpoint or your Appwrite server is not running as expected.

Appwrite itself works normally it is reachable both via the web console and the SDKs.
If I replace https with http, the command succeeds.
It is very likely not an issue with system permissions as adding sudo to the command does not change the outcome.
After a troubleshooting conversation on Discord, I was recommended to open an issue here.

👍 Expected behavior

appwrite client should work as expected with https.

👎 Actual Behavior

appwrite client only works with http.

🎲 Appwrite version

Version 1.0.x

💻 Operating system

Linux

🧱 Your Environment

Appwrite: 1.0.1
appwrite-cli: 1.1.1
OS: Fedora 36

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

🚀 Feature: Don't skip function deployment when selecting not to overwrite variables

🔖 Feature description

When I deploy a function that have variables configured in appwrite.json, the appwrite deploy function cli asks me to confirm if I want to overwrite the variables:
image
I would like that when I choose not to overwrite the variables, i.e. I do not type "YES" (I just hit "Enter" in the above example), the cli still deploys my function but respects my choice to not overwrite the variables.

🎤 Pitch

It is very annoying when actively developing functions to type "YES" (it's even case-sensitive) every time I deploy my functions - and this happens many many times in a day.
I understand you want to hint us about potential variable overwrites but the way this is currently happening is not optimal and rather gets in the way than helps. I don't have sensitive variables and I know it, so I don't need to be reminded about a non existing problem every time I deploy a function.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

code.tar.gz remains when function throws error

I got this error when I tried deploying my function:

✗ Error Request body larger than maxBodyLength limit

After exiting the CLI did not remove the code.tar.gz file it created. I believe the CLI should remove the file even if it crashes since there is no reason to leave it.

🐛 Bug Report: Homebrew updates stuck with v0.15.0

👟 Reproduction steps

Install the CLI using homebrew :

brew tap appwrite/sdk-for-cli https://github.com/appwrite/sdk-for-cli
brew update
brew install --HEAD appwrite

The version I get is v0.15.0

👍 Expected behavior

I should get the latest version v.0.18.4

👎 Actual Behavior

I am having v.0.15.0 even after running a brew upgrade

🎲 Appwrite version

Version 0.15.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Can't login via cli to appwrite 0.15.x

appwrite login
? Enter your email **************
? Enter your password **********
? Enter the endpoint of your Appwrite server **************

And got:

✗ Error Param "userId" is not optional.

Feature Request: .appwriteignore file

You should be able to add a .appwriteignore file to each function directory to make sure that some files are not uploaded. Ideally, there should be some config option to use .gitignore instead of .appwriteignore to make it easier, since most of the time the files would be the same.

Appwrite Database CreateCollection

I am trying to create a collection using Appwrite CLI. However, I cannot get the command to work. Each command throws a Server Error Message. I followed the examples and also tried to pass the parameters

appwrite database createCollection --name="todo-crud" --read="["*"]" --write="["*"]" --rules="[ {"label":"Name","key":"name","type":"text","default":"Empty Name","required":true,"array":false},]"

I get param read not optional if I run the below command
appwrite database createCollection --name="todo-crud" --read="" --write="" --rules=""

🐛 Bug Report: Deploy not including all files in src/ python:3.9

👟 Reproduction steps

I like to split my python project into multiple files as modules but the deploy command is not including those files with the index.py.

File structure:
image

List dir of index.py directory from function execution:
image

As you can see no other file from src/ was shipped with index.py

👍 Expected behavior

It should have the extra files in the same dir as the index.py file

👎 Actual Behavior

No extra files shipped to function using deploy command.

🎲 Appwrite version

Version 1.1.x

💻 Operating system

Windows

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Failed to execute process '/usr/local/bin/appwrite'.

When executing appwrite in a non-bash shell (I'm using fish). It will respond with unknown error.

> appwrite
Failed to execute process '/usr/local/bin/appwrite'. Reason:
exec: unknown error (errno was 8)
The file '/usr/local/bin/appwrite' is marked as an executable but could not be run by the operating system.

This is due to their being a newline before the shebang. It can be fixed by removing the newline.

/usr/local/bin/appwrite


#!/bin/bash
...

Probably an non-issue but thought I'd leave it here if anyone else runs into this.

🐛 Bug Report: Deploy Python function doesn't work because of roles

👟 Reproduction steps

  1. create a python 3.9 function using permissions and roles
permissions=[
    Permission.read(
        Role.user(req.env.get('APPWRITE_FUNCTION_USER_ID'))),
    Permission.update(
        Role.user(req.env.get('APPWRITE_FUNCTION_USER_ID'))),
    Permission.delete(
        Role.user(req.env.get('APPWRITE_FUNCTION_USER_ID')))
]
  1. appwrite deploy function
  2. select "MyAwesomeFunction"
  3. Error appears :
ℹ Info Deploying function game_post ( myAwesomeFunction )
✗ Error Invalid execute: Roles using the "role:" prefix have been removed. Use "users", "guests", or "any" instead.

👍 Expected behavior

It should deploy my function normally to my appwrite server.

👎 Actual Behavior

Error appears :

ℹ Info Deploying function game_post ( myAwesomeFunction )
✗ Error Invalid execute: Roles using the "role:" prefix have been removed. Use "users", "guests", or "any" instead.

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Windows

🧱 Your Environment

Appwrite 1.0.1.500
Appwrite-cli 1.0.0
Python Appwrite Sdk 1.0.0

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

appwrite functions createExecution prints 40 kb strange output

👟 Reproduction steps

I create a new function in an flutter project on macOS 12.6 on MacBook Air (M1, 2020)

$ appwrite login
$ appwrite init project
$ appwrite init function
$ appwrite deploy function

$ appwrite functions createExecution --functionId standardFunction >stdout.log

stdout.log contains 40 kb !

👍 Expected behavior

The result should contain only the first 14 lines of the stdout.log:

$id : 634ede62b964c6342d04
$createdAt : 2022-10-18T17:12:02.759+00:00
$updatedAt : 2022-10-18T17:12:02.765+00:00
$permissions
[
  "read(\"user:634289b0bdea1a7403cd\")"
]
functionId : defaultFunction
trigger : http
status : completed
statusCode : 200
response : {"areDevelopersAwesome":true}
stdout : Environment variables are not set. Function cannot use Appwrite SDK.
stderr : 

👎 Actual Behavior

The file stdout.log contains about 40 kb of strange output starting with this content:

$id : 634ede62b964c6342d04
$createdAt : 2022-10-18T17:12:02.759+00:00
$updatedAt : 2022-10-18T17:12:02.765+00:00
$permissions
[
  "read(\"user:634289b0bdea1a7403cd\")"
]
functionId : defaultFunction
trigger : http
status : completed
statusCode : 200
response : {"areDevelopersAwesome":true}
stdout : Environment variables are not set. Function cannot use Appwrite SDK.
stderr : 
duration
s : 1
e : -3
c
[
  160598754882,
  81250000000000
]
constructor : function BigNumber(v, b) {
      var alphabet, c, caseChanged, e, i, isNum, len, str,
        x = this;

...
here are about 40 kb source code (see attachment)
... 

and ending with this:

toJSON : function () {
      return valueOf(this);
    }
_isBigNumber : true
✓ Success 

Logs on the web console

The Logs on the web console contain expected content:

  • Response → {"areDevelopersAwesome":true}
  • Stdout → Environment variables are not set. Function cannot use Appwrite SDK.
  • Stderr → No errors were logged.

http traffic

The http traffic monitored with Proxyman is also ok:

POST /v1/functions/defaultFunction/executions HTTP/1.1
Accept: application/json, text/plain, */*
content-type: application/json
x-sdk-name: Command Line
x-sdk-platform: console
x-sdk-language: cli
x-sdk-version: 1.1.1
user-agent: AppwriteCLI/1.1.1 (Darwin Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101; arm64)
X-Appwrite-Response-Format: 1.0.0
x-appwrite-project: cli_functions_bug
x-appwrite-locale: en-US
cookie: a_session_console_legacy=eyJpZCI6IjYzNDI4OWIwYmRlYTFhNzQwM2NkIiwic2VjcmV0IjoiYTk3ZGUxMzg1OWNmOGYwYTMyYTE1M2E1MzljNjA1ZmE1YWYyZWM5YzNhODQyNGZhZjI2MDAzODM5NWQ3NDlhMDQ5OGE5MDM1ODcxMjA1ZGU0NzFlZjU0MTU4NjgzZGNjMDdkMzM4ZGZlOTE2MTk2MWZjMDI1ZjZkMmM0OGZmMWI4YjhlNmU4Y2Q4NDRlNGFhNDVmMTJkNTg1MWRjYjc4MzZmOTU0NjFhYjRiMWNjYWI4YWEzYmFjYzllZWVhMDZjOWVmZjgwNmQ5NmE1MGRlZGJmNWUwZmY2MzI2YjJkZjZlZjY2NjU3NTMyMTk0ZjljMzRiZjM4OGMxNzJhNDEyYSJ9; expires=Sun, 15-Oct-2023 15:41:44 GMT; path=/; httponly
x-appwrite-mode: admin
Content-Length: 2
host: 192.168.2.23
Connection: close

{}

response:

{
  "$id": "634ea5cf0f154bcf417d",
  "$createdAt": "2022-10-18T13:10:39.061+00:00",
  "$updatedAt": "2022-10-18T13:10:39.070+00:00",
  "$permissions": [
    "read(\"user:634289b0bdea1a7403cd\")"
  ],
  "functionId": "defaultFunction",
  "trigger": "http",
  "status": "completed",
  "statusCode": 200,
  "response": "{\"areDevelopersAwesome\":true}",
  "stdout": "Environment variables are not set. Function cannot use Appwrite SDK.",
  "stderr": "",
  "duration": 0.002368927001953125
}

stdout.log

🎲 Appwrite version

Version 1.0.x

💻 Operating system

MacOS

🧱 Your Environment

$ appwrite --version
1.1.1

Appwrite server:
v:1.0.2.501

$ cat appwrite.json 
{
    "projectId": "cli_functions_bug",
    "projectName": "cli_functions_bug",
    "functions": [
        {
            "$id": "defaultFunction",
            "name": "defaultFunction",
            "runtime": "dart-2.17",
            "path": "functions/defaultFunction",
            "entrypoint": "lib/main.dart",
            "ignore": [
                ".packages",
                ".dart_tool"
            ],
            "execute": [],
            "events": [],
            "schedule": "",
            "timeout": 15
        }
    ]
}                      

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

🐛 Bug Report: Homebrew is installing outdated version of Appwrite CLI (0.15.0)

👟 Reproduction steps

When I tried to install Appwrite CLI using Homebrew commands,
brew tap appwrite/sdk-for-cli https://github.com/appwrite/sdk-for-cli
brew update
brew install --HEAD appwrite

It is actually installing Appwrite CLI 0.15.0, an outdated version for some reason.

👍 Expected behavior

It should install Appwrite CLI 1.1.1 as of 6 Oct 2022.

👎 Actual Behavior

It is installing Appwrite CLI 0.15.0
Screenshot 2022-10-06 at 6 22 32 PM

🎲 Appwrite version

Version 1.0.x

💻 Operating system

MacOS

🧱 Your Environment

Appwrite: 1.0.1
Docker: 4.12.0 (85629)
OS: MacOS Monterey 12.6 (21G115)
DNS: CloudFlare

I command this to run appwrite:
docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ appwrite/appwrite:1.0.1

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and did find similar issue

🏢 Have you read the Code of Conduct?

Use Case that blocks login with unfriendly & undocumented fix

So:
I just started playing with appwrite.

  • Installed appwrite in my local docker. Everything broke (makes sense, my local docker installation is super broken). Decided to go for the 1-click gitpod one. Created a project and a user there. Everything works!
  • Installed the appwrite-cli package, and tried loggin-in.
    I probably copied the wrong url or something like that because it threw the Error Not Found (the general_route_not_found one, if I put the --verbose option).
    Thing is, I couldn't change the URL to fix my issue! On every login attempt, the CLI seems to cache the URL, so I got myself in a loop error situation.

Because I was pretty sure that the problem was local, not in my Gitpod instance, I tried clearing the cache somehow:

  • Tried uninstalling the npm package.
  • Tried the appwrite logout
  • Finally, I gave up, and started looking up the code for appwrite-cli, and I guessed (correctly) that this is where the data is stored:
    super(`${homeDir}/${path}`);

So, I just deleted that and got to try again until I figured out my error (I was hitting the appwrite root URL instead of the appwrite project server's URL).
So the fix was finally:

  rm -rf ~/.appwrite/prefs.json
  appwrite login

...and then try again


My point? Needing to fix issues by reading the code, it's not really user-friendly. The config location should be disclosed in a more visible place, IMHO.
But more importantly, I believe that after a login error (and specially after the Not Found error), the URL shouldn't be cached. Otherwise, the error state is perpetuated. And I'm uncertain if ever caching that URL is a good idea because changing the appwrite destination gets more cumbersome that it needs to, doesn't it?

🐛 Bug Report: Deploy collection does not maintain the order of the attributes defined in the Appwrite.json file

👟 Reproduction steps

run appwrite deploy collection command

👍 Expected behavior

The order of the defined attributes of the appwrite.json file must be maintained when deployed

👎 Actual Behavior

does not maintain the order of the attributes defined in the appwrite.json file they are sorted randomly

🎲 Appwrite version

Version 1.3.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

🐛 Bug Report: "TypeError: graphql.command is not a function"

👟 Reproduction steps

After installation on MacOS I type the following

appwrite -v

and get this error report:

/opt/homebrew/Cellar/appwrite/HEAD-9007d34/libexec/lib/node_modules/appwrite-cli/lib/commands/graphql.js:67
    .command(`query`)
     ^

TypeError: graphql.command is not a function
    at Object.<anonymous> (/opt/homebrew/Cellar/appwrite/HEAD-9007d34/libexec/lib/node_modules/appwrite-cli/lib/commands/graphql.js:67:6)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
    at Module.load (node:internal/modules/cjs/loader:1103:32)
    at Module._load (node:internal/modules/cjs/loader:942:12)
    at Module.require (node:internal/modules/cjs/loader:1127:19)
    at require (node:internal/modules/helpers:112:18)
    at Object.<anonymous> (/opt/homebrew/Cellar/appwrite/HEAD-9007d34/libexec/lib/node_modules/appwrite-cli/index.js:14:21)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)

Node.js v19.5.0

I tried installing it using all the methods provided: NPM, Homebrew and terminal. Outcome is the same.

👍 Expected behavior

It should show the version number.

👎 Actual Behavior

/opt/homebrew/Cellar/appwrite/HEAD-9007d34/libexec/lib/node_modules/appwrite-cli/lib/commands/graphql.js:67
    .command(`query`)
     ^

TypeError: graphql.command is not a function
    at Object.<anonymous> (/opt/homebrew/Cellar/appwrite/HEAD-9007d34/libexec/lib/node_modules/appwrite-cli/lib/commands/graphql.js:67:6)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
    at Module.load (node:internal/modules/cjs/loader:1103:32)
    at Module._load (node:internal/modules/cjs/loader:942:12)
    at Module.require (node:internal/modules/cjs/loader:1127:19)
    at require (node:internal/modules/helpers:112:18)
    at Object.<anonymous> (/opt/homebrew/Cellar/appwrite/HEAD-9007d34/libexec/lib/node_modules/appwrite-cli/index.js:14:21)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)

Node.js v19.5.0

🎲 Appwrite version

Version 1.2.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

🐛 Bug Report: Error Param "region" is not optional.

👟 Reproduction steps

run appwrite init project command

👍 Expected behavior

The project should have been created

👎 Actual Behavior

The project is not creating and giving the issue in the title

🎲 Appwrite version

Version 1.1.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

[BUG] Login to a selfsigned host

Hi there!
I discovered that with the 0.17.1 version i can't appwrite login to a self signed host (like localhost).

If i downgrade to the Appwrite Cli 0.15 it works without problems.
But with a "prefs.conf" already configured, the 0.17.1 version works.

PS: appwrite 0.14.2

🐛 Bug Report: CLI install script fails for Apple Silicon Mac

curl -sL https://appwrite.io/cli/install.sh | bash fails on Apple Silicon Mac

For Apple Silicon Mac, sudo is needed when cp to "/usr/local/bin".

This behavior is different from Intel Mac which doesn't need sudo.

Error Log

➜  ~ curl -sL https://appwrite.io/cli/install.sh | bash

    _                            _ _           ___   __   _____
   /_\  _ __  _ ____      ___ __(_) |_ ___    / __\ / /   \_   \
  //_\| '_ \| '_ \ \ /\ / / '__| | __/ _ \  / /   / /     / /\/
 /  _  \ |_) | |_) \ V  V /| |  | | ||  __/ / /___/ /___/\/ /_
 \_/ \_/ .__/| .__/ \_/\_/ |_|  |_|\__\___| \____/\____/\____/
       |_|   |_|



🔥 Welcome to the Appwrite CLI install shield 🛡.
[1/4] Getting System Info ...

OS : darwin
ARCH : arm64
REQUIRES ROOT : false

[2/4] Performing Checks ...
🚦 Checking if docker is installed ...
✅ Done ...

🏃‍ Checking if docker daemon is running ...
✅ Done ...

[3/4] Starting installation ...
🐳 Pulling docker image ...
✅ Done ...

🚧 Setting Permissions
✅ Done ...

📝 Copying temporary file to /usr/local/bin/appwrite ...
cp: /usr/local/bin/appwrite: Permission denied
❌ Failed to copy temporary file to /usr/local/bin/appwrite ...

🚀 Feature: make cli "docker run"nable

🔖 Feature description

Being able to run the cli as a docker container would be great.

I've found the image on Docker Hub here: https://hub.docker.com/r/appwrite/cli
Is that just an old remnant?

And the old Pull Request #2 that looked like a good start 4 years ago

Since appwrite itself is already neatly spread out over several containers in the official docker-compose.yml it would feel natural to have the cli as a service as well. I guess that was the reasoning 4 years ago as well:)

Would be happy to see that considered again.

🎤 Pitch

I want to use it in the docker-compose.yml as a service so I can do docker-compose exec appwrite-cli users list for example.

I don't want to install an extra binary or npm to install it globally because I like my dependencies bundled with the project they belong to.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

appwrite deploy function catch SyntaxError: Unexpected token o in JSON at position 1

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/appwrite-cli/lib/commands/functions.js b/node_modules/appwrite-cli/lib/commands/functions.js
index 1e90aac..90e22af 100644
--- a/node_modules/appwrite-cli/lib/commands/functions.js
+++ b/node_modules/appwrite-cli/lib/commands/functions.js
@@ -169,7 +169,7 @@ const functionsUpdate = async ({ functionId, name, execute, vars, events, schedu
     }
 
     if (typeof vars !== 'undefined') {
-        payload['vars'] = JSON.parse(vars);
+        payload['vars'] = vars
     }
 
     if (typeof events !== 'undefined') {

This issue body was partially generated by patch-package.

Bug: 0.18.2: Cannot find module './database'

The 0.18.2 release throws an error when trying to execute. On Windows as well as Linux.

Error: Cannot find module './database'
Require stack:
- /snapshot/sdk-for-cli/lib/commands/init.js
- /snapshot/sdk-for-cli/index.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1819:46)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1719:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/snapshot/sdk-for-cli/lib/commands/init.js:9:37)
    at Module._compile (pkg/prelude/bootstrap.js:1794:22)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/snapshot/sdk-for-cli/lib/commands/init.js',
    '/snapshot/sdk-for-cli/index.js'
  ],
  pkg: true
}

Downgrading to 0.18.1 works fine.

No win x64 download for 0.17.1

For some reason, the 1.17.1 release has no x64 version that can be downloaded. This causes the install.ps1 script to fail when trying to download the executable.

Welcome to the Appwrite CLI install shield.
[1/4] Getting System Info ...
[2/4] Downloading Appwrite CLI binary ...
???? Fetching latest version ...
Invoke-WebRequest : The remote server returned an error: (404) Not Found.
At line:62 char:7
+       Invoke-WebRequest -Uri $GITHUB_x64_URL -OutFile $APPWRITE_DOWNL ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

New-Item : An item with the specified name C:\Users\cebbi\AppData\Local\Appwrite already exists.
At line:65 char:5
+     New-Item -ItemType Directory -Path $APPWRITE_INSTALL_DIR
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceExists: (C:\Users\cebbi\AppData\Local\Appwrite:String) [New-Item], IOException
    + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand

Move-Item : Cannot find path 'C:\Users\cebbi\AppData\Local\Temp\appwrite.exe' because it does not exist.
At line:66 char:5
+     Move-Item $APPWRITE_DOWNLOAD_DIR $APPWRITE_INSTALL_PATH
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\cebbi\...mp\appwrite.exe:String) [Move-Item], ItemNotFoundExce
   ption
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.MoveItemCommand

[3/4] Starting installation ...
Skipping to add Appwrite to User Path.
Cleaning up mess ...
[4/4] Finishing Installation ...
Cleaning up mess ...
???? May the force be with you.
To get started with Appwrite CLI, please visit https://appwrite.io/docs/command-line

bug: using appwrite cli to update user prefs doesn't update them

I tried the following commands to update an existing users preferences:

root@expirapp:~# appwrite users updatePrefs --userId="613e723e32487" --prefs="{'wiek': 21}"
message : Invalid prefs: Value must be a valid object.
code : 400
version : 0.10.2
root@expirapp:~# appwrite users updatePrefs --userId="613e723e32487" --prefs="{'wiek': '21'}"
message : Invalid prefs: Value must be a valid object.
code : 400
version : 0.10.2
root@expirapp:~# appwrite users updatePrefs --userId="613e723e32487" --prefs="{"wiek": "21"}"
message : Invalid prefs: Value must be a valid object.
code : 400
version : 0.10.2

and many other combinations of ", ' and no quotations at all. It always gives me the same error (Value must be a valid object). When I use the CLI to create a user, it does create the user, but leaves the prefs untouched (meaning empty, no matter if I set them to something or not).

🐛 Bug Report: CLI only matches on collection id rather than database id and collection id

👟 Reproduction steps

  1. Create 2 databases.
  2. In each database, create a collection. Both with the same collection ID
  3. Run appwrite init collection
  4. Select all collections

👍 Expected behavior

CLI shall write all databases into the appwrite.json

👎 Actual Behavior

CLI only writes 1 set of database into appwrite.json

🎲 Appwrite version

Version 1.2.x

💻 Operating system

Windows

🧱 Your Environment

Local docker

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

functions createTag fails when the full file path where the code is has a space character

If the full file path where the code is located has a space character, i.e. /home/javi/functions/analyze Image/ the functions createTag command

appwrite functions createTag \
    --functionId=60dcbc0b83abc \
    --command='python main.py' \
    --code='./deploy'

fails with this error.

docker: invalid reference format.
See 'docker run --help'.

Otherwise, /home/javi/functions/analyzeImage/, it works fine.

  • Appwrite CLI 0.10.0
  • Docker version 20.10.6-ce, build 8728dd246c3a
  • Linux linux-openSUSE 5.12.13-1-default

CLI script does not install in windows 10

Hi! I tried to run

iwr -useb https://appwrite.io/cli/install.ps1 | iex

but I got an error. It looks like it is a bug. I don't know powershell or I would fix it.

iex : At line:54 char:4
+ "@ -ForegroundColor red
+    ~~~~~~~~~~~~~~~~
Unexpected token '-ForegroundColor' in expression or statement.
At line:54 char:21
+ "@ -ForegroundColor red
+                     ~~~
Unexpected token 'red' in expression or statement.
At line:57 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
At line:1 char:49
+ iwr -useb https://appwrite.io/cli/install.ps1 | iex
+                                                 ~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.InvokeExpressionCommand

Thanks!

Deploying collections doesn't update collection permission

Steps for reproduce:

  • create a new database and a new collection
  • appwrite init collection --all
  • edit appwrite.json changing permission of collection created
  • appwrite deploy collection --all

The collection's permission will not update. Instead, if you delete this collection and then run appwrite deploy collection --all it will be created with right permission. So it just do not update collection's permission.

🐛 Bug Report: appwrite CLI does not properly parse boolean values

👟 Reproduction steps

(appwrite v0.11.0)

The CLI does not correctly parse boolean values. I believe it passes them as strings without converting and checking if it is a valid boolean value.

In my case, I am attempting to set the emailVerification value of a user manually with the CLI with the following command:
appwrite users updateVerification --userId="618d12a8701cd" --emailVerification="true"

(I have tried "true", "True", 'true', 'True', and just about every variant i can think of with the same result.)

👍 Expected behavior

The CLI should accept and parse the strings true and/or false as boolean values by sanitizing the input and converting the literal strings "true" or "false" to their boolean counterparts, and only give the error message response if any arguement besides true/false is submitted.

👎 Actual Behavior

The command I submitted received the following response:

appwrite users updateVerification --userId="618d12a8701cd" --emailVerification="true"
message : Invalid emailVerification: Value must be a valid boolean
code : 400
version : 0.11.0

🎲 Appwrite version

Appwrite version 0.11.0

💻 Operating system

Linux

🧱 Your Environment

I installed docker following the instructions provided by docker themselves.
Appwrite CLI was installed with no problems.

During appwrite init i set the endpoint to my appwrite server hosted on digital ocean (which functions just fine for console and responds to queries appropriately in a web project).

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Hard wrap STDOUT past 100-120 columns

As an example, appwrite help produces a list of services. Zero of these lines are under 80 columns, ["storage", "users"] are the only under 100 (the current linux kernel standard), and the longest line teams is 149 columns.

Just a style preference, but it's a pain point to resize my terminal every time I use the CLI.

Feature Request:- cloning of projects, databases and collections

Adding more user/developer-friendly functions like cloning would be helpful

The current approach for cloning a project is is

  1. init the database
  2. init the collection
  3. create a new project
  4. manually edit the project id and project name inside appwrite.json to the new project
  5. deploy the collection

which a beginner developer might feel overhead..

what I suggest is a simple clone feature which can clone projects, databases and collections... This can be implemented as

appwrite clone --projectId myProject --cloneProjectId myProjectClone --cloneProjectName MyprojectClone

Deploy collection will set database name equal to database Id

How to reproduce:

  • From a new project create a database and a collection
  • execute appwrite init collection --all
  • delete database created from appwrite console
  • execute appwrite deploy collection --all

Appwrite CLI deploy the right database and collection, but put in database's name the database's id

🚀 Feature: Clarify when no functions are deployed

🔖 Feature description

If the user runs appwrite deploy function and presses enter without selecting any function, the CLI proceeds without informing user of anything.

If the user (like me) doesn't read the instructions properly, they might press enter and think the first function has been deployed.

Screencast.from.11-10-22.09.48.18.PM.IST.mp4

🎤 Pitch

Prompt the user to select at least one function to deploy.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Unable to login to appwrite instance on azure from cli

Hi i'm having some issues logging in to my appwrite instance on an Azure VM, via the cli, i set the appwrite client --endpoint to the hostname (http://tgappwrite.eastus.cloudapp.azure.com) of the VM (which is an alias for the public IP), the link opens up fine and i can open up the appwrite instance from the browser and login from there as well, but when i try logging in i keep getting this "NOt found" error, I've been stuck here for a while please help.

image

🐛 Bug Report: Team id cannot be found when creating project

👟 Reproduction steps

When i try to use appwrite projects create

👍 Expected behavior

should create a project

👎 Actual Behavior

(base) ➜ ~ appwrite teams create --teamId 1235 --name test-team

$id : 1235
$createdAt : 2023-01-20T09:14:22.859+00:00
$updatedAt : 2023-01-20T09:14:22.859+00:00
name : test-team
total : 0
✓ Success 

(base) ➜ ~ appwrite projects create --name test2 --projectId "unique()" --teamId 1235

✗ Error Team with the requested ID could not be found.

🎲 Appwrite version

Version 1.1.x

💻 Operating system

MacOS

🧱 Your Environment

cli: [email protected] from npm
appwrite: [email protected] from docker-compose

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

🐛 Bug Report: Cannot deploy collections in appwrite.json with Int Attributes

👟 Reproduction steps

  1. Create a new Integer Attribute via the Web Interface, enter a name and leave all other fields empty and click create.
  2. Connect the Appwrite CLI 2.0 using appwrite login
  3. Create appwrite.json using appwrite init --all
  4. Inspect the Integer Attribute in appwrite.json, it should show a min/max value of -9223372036854776000/9223372036854776000.
  5. Try to deploy the appwrite.json using appwrite deploy collection
  6. Choose the collection and confirm the overwrite.
  7. An Error gets thrown.

👍 Expected behavior

Should be able to apply the created appwrite.json.

It would also be nice if the error message could specify the allowed min/max values, or a bit more description why the passed value is invalid.

👎 Actual Behavior

$ appwrite deploy collection
? Which collections would you like to deploy? MyCollection (62212c12df87ffcd4478)
ℹ Info Deploying collection MyCollection ( 62212c12df87ffcd4478 )
ℹ Info Collection MyCollection ( 62212c12df87ffcd4478 ) already exists.
? Are you sure you want to override this collection? This can lead to loss of data! Type "YES" to confirm. YES
ℹ Info Updating attributes ...
✗ Error Invalid min: Value must be a valid integer

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

MacOS

🧱 Your Environment

Using Appwrite 0.13.0 but that isn't available in the 'Appwrite version'-Dropdown yet.

The Server was upgraded from 0.12.1 using the instructions at: https://appwrite.io/docs/upgrade running the Install and Data Migration commands.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

bug: the term 'appwrite' is not recognized as the name of a cmdlet

After installing the install script from the CLI without problem, it does not recognize appwrite as a command within the console. I am using PowerShell to run the command.

appwrite: The term 'appwrite' is not recognized as the name of a cmdlet, function, script file, or executable program. Check
if you typed the name correctly, or if you included a path, verify that the path is correct and try again.
Online: 1 Character: 1
+ appwrite version
+ ~~~~~~~~
     + CategoryInfo: ObjectNotFound: (appwrite: String) [], CommandNotFoundException
     + FullyQualifiedErrorId: CommandNotFoundException 

Shell appwrite init conf is reset after updating a property

Complete appwrite init steps

then update any property
appwrite client setLocale --locale="en-US"

End up with
❌ Oops We were unable to load your preferences. Ensure that you have run 'appwrite init' before using the CLI

Setup under powershell

🐛 Bug Report: Issue with installing AppWrite using the terminal command

👟 Reproduction steps

When I installed AppWrite CLI for the first time using curl -sL https://appwrite.io/cli/install.sh | bash then running appwrite -v I get an error

👍 Expected behavior

Installing AppWrite with Terminal should work fine

👎 Actual Behavior

After installing AppWrite using the terminal command and then running appwrite -v I get the following error:

/snapshot/sdk-for-cli/lib/questions.js:258
message: 'Are you sure you want to override this function's variables? This can lead to loss of secrets! Type "YES" to confirm.'
                                                              ^

SyntaxError: Unexpected identifier
    at Object.compileFunction (node:vm:354:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Module._compile (pkg/prelude/bootstrap.js:1801:32)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1719:31)
    at require (node:internal/modules/cjs/helpers:102:18)

But when installing AppWrite with HomeBrew

brew tap appwrite/sdk-for-cli https://github.com/appwrite/sdk-for-cli

brew update

brew install --HEAD appwrite

the installation works fine

🎲 Appwrite version

Version 0.15.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

🚀 Feature: Improve Error Message when Authentication is Required

🔖 Feature description

If the cookie in the pref.json is set but invalid, appwrite init project returns with:

✗ Error User (role: guests) missing scope (projects.read)
with verbose
$ appwrite init project --verbose
? How would you like to start? Link this directory to an existing Appwrite project
AppwriteException [Error]: User (role: guests) missing scope (projects.read)
    at Client.call (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/client.js:209:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async projectsList (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/commands/projects.js:33:16)
    at async Object.choices (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/questions.js:129:28) {
  code: 401,
  response: [Object: null prototype] {
    message: 'User (role: guests) missing scope (projects.read)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: 'dev',
    file: '/usr/src/code/app/controllers/general.php',
    line: 365,
    trace: [
      [Object: null prototype],
      [Object: null prototype],
      [Object: null prototype]
    ]
  }
}
✗ Error User (role: guests) missing scope (projects.read)

It would be nice if the error message was more helpful. Tanmoy Karmakar has suggested:

Cannot access projects. Login is required use appwrite login command

FYI, if the cookie is not set we respond with:

✗ Error Session not found. Please run `appwrite login` to create a session

🎤 Pitch

The current error is very technical and doesn't give the user any guidance on how to proceed. A clearer, more helpful error message will create a better developer experience.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Handling arrays returned from API

When an API response returns an array, the CLI doesn't properly handle arrays. Because of this, as an example, permissions cannot be viewed via the CLI.

From the endpoint /v1/storage/files/{fileId}, the $permissions field is empty:

aspire :: ~ » appwrite storage getFile --fileId="6032c58d7ccb6"
$id : 6032c58d7ccb6
$permissions :
name : fnlist.png
dateCreated : 1613940109
signature : cea8e7c354353f26d9fbd4755005b518
mimeType : image/png
sizeOriginal : 26184

From /v1/storage/files and v1/functions, $permissions returns only the array with length in parentheses:

arrays

'appwrite init function' doesn't work on Windows

Seems like there might be something linux specific with appwrite init function. When attempting on Windows I get

Error ENOENT: no such file or directory, open 'C:\...\functions\My Awesome Function\README.md'

Node version: v17.7.1
Appwrite CLI version: 0.15.0

Tried with both CMD and Powershell

{App-write Sdk-for-cli }

{ > # - [x] appwrite could be fun I love to come back and give a different comment, after I have mastered appwrite }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.