appwrite / sdk-for-cli

[READ-ONLY] Official Appwrite CLI >_
BSD 3-Clause "New" or "Revised" License
85 stars 29 forks source link

🐛 Bug Report: configureHelp is not a function #93

Closed e1ke closed 10 months ago

e1ke commented 10 months ago

👟 Reproduction steps

I tried installing the appwrite CLI by script https://appwrite.io/docs/command-line#installWithScript with the following command curl -sL https://appwrite.io/cli/install.sh | bash The installation went successfull, I can see "May the force be with you" After that i run appwrite -v and get an error thrown

👍 Expected behavior

It should display the appwrite version

👎 Actual Behavior

It actually shows an error in bootstrap.js:

appwrite -v                                                          
pkg/prelude/bootstrap.js:1740
      throw error;
      ^

TypeError: (intermediate value).description(...).configureHelp is not a function
    at Object.<anonymous> (/snapshot/sdk-for-cli/lib/commands/assistant.js:13:90)
    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)
    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)
    at Object.<anonymous> (/snapshot/sdk-for-cli/index.js:18:23)
    at Module._compile (pkg/prelude/bootstrap.js:1794:22)

same error on appwrite login

🎲 Appwrite version

Version 1.3.7 sdk-for-cli version 3.0.0 (released 1h ago) on CLI version 3.0.0, I read the following info This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases] but i am not even able to connect to my appwrite server. Anyway, I will try version sdk-for-cli version 2.0.2 later this evening

💻 Operating system

Linux

🧱 Your Environment

I use Linux Pop!_OS 22.04 LTS x86_64 Kernel 6.2.6-76060206-generic

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

🏢 Have you read the Code of Conduct?

e1ke commented 10 months ago

for others: with version 2.0.2 it worked for me. I did the following:

I downloaded the script curl -sL https://appwrite.io/cli/install.sh -o appwrite-cli-install.sh changed its version to 2.0.2 (in function 'downloadBinary()') with nano appwrite-cli-install.sh GITHUB_LATEST_VERSION="2.0.2" then made it executable chmod +x appwrite-cli-install.sh and ran it ./appwrite-cli-install.sh

lucasctd commented 10 months ago

Having a really hard time with this release of Appwrite :/ 1.4.0 was broken then 1.4.1 worked after some updates to the env file, now my functions are returning http 500 and I am not even able to use its CLI to deploy new functions...

lucasctd commented 10 months ago

for others: with version 2.0.2 it worked for me. I did the following:

I downloaded the script curl -sL https://appwrite.io/cli/install.sh -o appwrite-cli-install.sh changed its version to 2.0.2 (in function 'downloadBinary()') with nano appwrite-cli-install.sh GITHUB_LATEST_VERSION="2.0.2" then made it executable chmod +x appwrite-cli-install.sh and ran it ./appwrite-cli-install.sh

@e1ke did it really work for you?

v2.0.2 will not throw the error in the description of this issue but will display an error if you try to create a new function:

? What would you like to name your function? My Awesome Function
? What ID would you like to have for your function? unique()
? What runtime would you like to use? Node.js (node-18.0)
✗ Error Server Error

and in the appwrite container we'll see:

[Error] Timestamp: 2023-09-01T22:06:47+00:00
[Error] Method: POST
[Error] URL: /v1/functions
[Error] Type: Utopia\Database\Exception\Structure
[Error] Message: Invalid document structure: Unknown attribute: "schedule"
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 2619
e1ke commented 10 months ago

What appwrite server version are you using? I am using 1.3.7, maybe that is why it's working for me. I read somewhere, that cli appwrite Version 1.4 needs cli version 3.0. Try to downgrade to 1.3.7 if you are newer

kumarvivek06071999 commented 10 months ago

👟 Reproduction steps

I tried installing the appwrite CLI by script https://appwrite.io/docs/command-line#installWithScript with the following command curl -sL https://appwrite.io/cli/install.sh | bash The installation went successfull, I can see "May the force be with you" After that i run appwrite -v and get an error thrown

👍 Expected behavior

It should display the appwrite version

👎 Actual Behavior

It actually shows an error in bootstrap.js:

appwrite -v                                                          
pkg/prelude/bootstrap.js:1740
      throw error;
      ^

TypeError: (intermediate value).description(...).configureHelp is not a function
    at Object.<anonymous> (/snapshot/sdk-for-cli/lib/commands/assistant.js:13:90)
    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)
    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)
    at Object.<anonymous> (/snapshot/sdk-for-cli/index.js:18:23)
    at Module._compile (pkg/prelude/bootstrap.js:1794:22)

same error on appwrite login

🎲 Appwrite version

Version 1.3.7 sdk-for-cli version 3.0.0 (released 1h ago) on CLI version 3.0.0, I read the following info This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases] but i am not even able to connect to my appwrite server. Anyway, I will try version sdk-for-cli version 2.0.2 later this evening

💻 Operating system

Linux

🧱 Your Environment

I use Linux Pop!_OS 22.04 LTS x86_64 Kernel 6.2.6-76060206-generic

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

  • [x] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

bro older version works properly npm install -g appwrite-cli@2.0.2

chexxor commented 10 months ago

https://github.com/appwrite/sdk-for-cli/blob/22b31dded03c02b9769729a6d593e4e205a0baa8/lib/commands/assistant.js#L13

The "commandDescriptions" list is missing the value "assistant", or this line can use a different named description.

I don't see a description in that list of descriptions which would match the assistant command, so we probably need to add a new item to that list with name "assistant".

bfritscher commented 10 months ago

@appwrite did you test before releasing?! It seems that all the new modules do not have a commandDescriptions not only assistant, but also vcs, project, proxy, migration. And migration command has project code in it... over 5 days without a cli fix!

DH-555 commented 10 months ago

@bfritscher You can use the previous cli version meanwhile. It will be fixed soon

lucasctd commented 10 months ago

@bfritscher You can use the previous cli version meanwhile. It will be fixed soon

It doesn't work dude. It'll throw an error when you try to create a new function, as I've described above.

e1ke commented 10 months ago

the previous cli version itself works, but maybe not in combination with an updated appwrite 1.4.x server. At least I am working with cli version 2.0.2 and appwrite server 1.3.7 successfully

bfritscher commented 10 months ago

for appwrite 1.4 I thin v 3 is required... You can fix the cli by adding:

const commandDescriptions = {
    "assistant": "",
    "project": "",
    "proxy": "",
    "vcs": "",
    "migrations": "",

in npm\node_modules\appwrite-cli\lib\parser.js

But, for me the whole migration to 1.4.1 is broken the functions table did not migrate correctly and I cannot add them even manually, I also have other strange errors...

joeyouss commented 10 months ago

The PR is merged. Thank you everyone.

lucasctd commented 10 months ago

@bfritscher thanks, I forked the repo and updated the code you said, then installed it using: npm install -g "https://github.com/lucasctd/sdk-for-cli.git#master"

it worked, but if you try to redeploy a function it'll throw an error:

Error Param "runtime" is not optional.

First deployment always run fine though.

thank you anyway.

DH-555 commented 10 months ago

@lucasctd The error seems to have been solved with next Appwrite version

bfritscher commented 10 months ago

Yes, based on this https://github.com/appwrite/appwrite/pull/6125/files they fixed some thing also the fields which did not get migrated correctly, I had to manually update the database to make functions work :-(

Kriihz77 commented 10 months ago

I performed the update of the indicated branch, created the function correctly, performed my development and tried to deploy with the command: appwrite deploy function, but it is showing the following error: ✗ Error Param "runtime" is not optional.

This is my appwrite.json

{
    "projectId": "XXXXX",
    "projectName": "XXXXXX",
    "functions": [
        {
            "$id": "XXXXX",
            "name": "TeamBase",
            "runtime": "python-3.10",
            "path": "functions/EquipoBase",
            "entrypoint": "src/index.py",
            "ignore": [
                "__pypackages__"
            ],
            "execute": [],
            "events": [],
            "schedule": "",
            "timeout": 15
        }
    ]
}
lucasctd commented 10 months ago

I performed the update of the indicated branch, created the function correctly, performed my development and tried to deploy with the command: appwrite deploy function, but it is showing the following error: ✗ Error Param "runtime" is not optional.

This is my appwrite.json

{
    "projectId": "XXXXX",
    "projectName": "XXXXXX",
    "functions": [
        {
            "$id": "XXXXX",
            "name": "TeamBase",
            "runtime": "python-3.10",
            "path": "functions/EquipoBase",
            "entrypoint": "src/index.py",
            "ignore": [
                "__pypackages__"
            ],
            "execute": [],
            "events": [],
            "schedule": "",
            "timeout": 15
        }
    ]
}

@criihz yeah, as I said it works only on the first deployment, if your function is already created/deployed in appwrite, it will throw that error. Seems we'll need to wait for the availability of this PR in the next release.

stnguyen90 commented 10 months ago

This will be fixed in version 3.0.1 of the CLI