sdk-for-cli icon indicating copy to clipboard operation
sdk-for-cli copied to clipboard

🐛 Bug Report: Attribute creation did not finish for too long on AppWrite-CLI 4.1.0

Open tripolskypetr opened this issue 2 years ago • 11 comments

👟 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?

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

🏢 Have you read the Code of Conduct?

tripolskypetr avatar Oct 15 '23 10:10 tripolskypetr

@tripolskypetr Can you please assign it to me

CodeDrinks270 avatar Oct 15 '23 17:10 CodeDrinks270

@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?

tripolskypetr avatar Oct 16 '23 07:10 tripolskypetr

Does the CLI still timeout?

stnguyen90 avatar Oct 16 '23 13:10 stnguyen90

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

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

tripolskypetr avatar Oct 18 '23 06:10 tripolskypetr

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

tripolskypetr avatar Nov 03 '23 03:11 tripolskypetr

@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.

abnegate avatar Nov 03 '23 04:11 abnegate

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

tripolskypetr avatar Nov 27 '23 09:11 tripolskypetr

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

stnguyen90 avatar Jul 07 '24 16:07 stnguyen90

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

tripolskypetr avatar Jul 12 '24 15:07 tripolskypetr

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

christyjacob4 avatar Jul 15 '24 13:07 christyjacob4

@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

tripolskypetr avatar Jul 15 '24 13:07 tripolskypetr