appwrite / sdk-for-cli

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

πŸ› Bug Report: Fails to deploy function thru appwrite cli when variables is defined. #111

Closed spontaneouscombustion closed 6 months ago

spontaneouscombustion commented 7 months ago

πŸ‘Ÿ Reproduction steps

Deploy a function with variables set on appwrite.json using appwrite cli appwrite.json

{
    "projectId": "ProjectID",
    "projectName": "ProjectName",
    "functions": [
        {
            "$id": "FunctionID",
            "name": "AdminUtil",
            "runtime": "node-18.0",
            "execute": [
                "any"
            ],
            "events": [],
            "schedule": "",
            "timeout": 15,
            "enabled": true,
            "logging": true,
            "entrypoint": "src/main.js",
            "commands": "npm install",
            "ignore": [
                "node_modules",
                ".npm"
            ],
            "path": "functions/admin",
            "variables": {
              "APITOKEN": "REDACTED"
            }
        }
    ], ...

I thinks this has something to do with this line https://github.com/appwrite/sdk-for-cli/blob/ead5533796ccfd5d1bbedb50e7bf65d2b0c1337f/lib/commands/deploy.js#L313C24-L313C39 using remoteVariables.length property in a statement even though remoteVariables is undefined

πŸ‘ Expected behavior

a successful deploy with the env variables defined/updated

πŸ‘Ž Actual Behavior

The deployment fail. The log reports "remoteVariables is not defined"

🎲 Appwrite version

Appwrite Cloud

πŸ’» Operating system

Linux

🧱 Your Environment

cloud.appwrite.io Runtime: Node.js 18

πŸ‘€ Have you spent some time to check if this issue has been raised before?

🏒 Have you read the Code of Conduct?

stnguyen90 commented 6 months ago

Closing as a duplicate of https://github.com/appwrite/sdk-for-cli/issues/112