appwrite / sdk-for-cli

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

πŸ› Bug Report: Attribute creation did not finish for too long on AppWrite-CLI 4.1.0 #135

Open tripolskypetr opened 10 months ago

tripolskypetr commented 10 months ago

πŸ‘Ÿ Reproduction steps

appwrite --version
4.1.0

appwrite deploy collection

...

β„Ή Info Collection APARTMENT does not exist in the project. Creating ...
βœ— Error Attribute creation did not finish for too long.

πŸ‘ Expected behavior

I made a migration script and It works well


const { $id, databaseId, attributes } = GET_COLLECTION("APARTMENT");

const migrate = async () => {

await databases.createCollection(databaseId, $id, 'APARTMENT');

for (const { key, type, required, array, size } of attributes) {
    console.log(`creating  ${key}: type=${type} array=${array} size=${size}`)
    if (type === "string") {
        await databases.createStringAttribute(databaseId, $id, key, size, required, undefined, array);
    }
    if (type === "boolean") {
        await databases.createBooleanAttribute(databaseId, $id, key, required, undefined, array);
    }
    await sleep(1_000);
}

}

migrate();

This worked. Looks like appwrite-cli does not reset not responding timeout after each attribute creation.

πŸ‘Ž Actual Behavior

The schema for the following collection should be deployed successfully. Right now It is not

{
    "projectId": "64b53d0c41fcf5193b12",
    "projectName": "ExampleProject",
    "databases": [
        {
            "$id": "64c4de8e7b31179809ef",
            "name": "DATABASE",
            "$createdAt": "2023-09-14T10:10:35.686+00:00",
            "$updatedAt": "2023-09-14T11:59:42.307+00:00",
            "enabled": true
        }
    ],
    "collections": [
        {
            "$id": "64d4a5782854ff66e9a1",
            "$permissions": [
                "create(\"any\")",
                "read(\"any\")",
                "update(\"any\")",
                "delete(\"any\")"
            ],
            "databaseId": "64c4de8e7b31179809ef",
            "name": "APARTMENT",
            "enabled": true,
            "documentSecurity": false,
            "attributes": [
                {
                    "key": "sanuzel_doma",
                    "type": "string",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": true,
                    "size": 48,
                    "default": null
                },
                {
                    "key": "balkon_doma",
                    "type": "string",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": true,
                    "size": 48,
                    "default": null
                },

                ...

🎲 Appwrite version

Appwrite Cloud

πŸ’» Operating system

Linux

🧱 Your Environment

Appwrite Cloud 1.4.5, Appwrite-cli 4.1.0

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

🏒 Have you read the Code of Conduct?

CodeDrinks270 commented 10 months ago

@tripolskypetr Can you please assign it to me

tripolskypetr commented 10 months ago

@CodeDrinks270 @joeyouss

Looks like I don't have permission to assign anyone to this issue. Joe, is there anything I can do to speed up the process of solving that problem?

stnguyen90 commented 10 months ago

Does the CLI still timeout?

tripolskypetr commented 10 months ago

@stnguyen90 Yeap, It still timeout. This schema will help to reproduce the error

https://gist.github.com/tripolskypetr/c1f84aa39261911291ec95addca0a839

tripolskypetr commented 10 months ago

I have received the message in my mailbox

Hi there, Thanks for getting in touch! It looks like the JSON you provided exceeds the limit of allowed attributes. You'll need to reduce the amount of attributes in the "APARTMENT" collection to be able to deploy. Currently the limit is just over 1000 attributes. Regards, Jake

Nope, Jake, You are wrong.

  1. The APARTMENT collection got only 200 attributes

ezgif-3-5e0143a6c1 (1)

  1. The maximum key length is 36 characters, all collection attributes does not violate this rule

image

  1. The 16kb MariaDB attribute limit is not reached (source). Total size of all attributes is 11440 which is also ok

image

So, are there any plans to solve this issue?

For the above reasons, the problem is in the CLI. Right now the last version of appwrite-cli is 4.1.0. It published 2 months ago

screenshot

@abnegate

abnegate commented 10 months ago

@tripolskypetr Ah I see, yep the issue definitely looks to be in the CLI if you're only getting 200 attributes created, I will follow up with an investigation.

You will still need to reduce the number of attributes - once we resolve the CLI issue, you'll run into the column count limit noted here. The actual limit will be slightly lower since Appwrite has some internal attributes on each collection.

tripolskypetr commented 9 months ago

Looks like still not fixed. I have upgraded appwrite-cli to 4.2.0, published 6 days ago. Got same error while deploying collection with 84 attributes on Toshiba HDD appwrite installation.

image

Creating attributes one-by-one with that script works OK. Maybe It going to be useful to someone

stnguyen90 commented 2 months ago

The user suggests increasing the delay/timeout as creating can be much slower on a WSL2 docker on windows

https://discord.com/channels/564160730845151244/1207985484333318184/1217053962797187193

tripolskypetr commented 1 month ago

@stnguyen90 For a last half year I am trying to suggest to purge the magic constant antipattern completely

christyjacob4 commented 1 month ago

@tripolskypetr apologies for the delay. We are working on this issue and a fix will be released as part of the next version.

tripolskypetr commented 1 month ago

@christyjacob4

During the miscommunication period I implemented the alternative, see appwrite-backup-tool.

I have sent a CV for building the CLI and other dev tools for the full time. Are the Appwrite team recruiting newbies? I think my experience will be quite useful to bring dev experience to the best