I'm using the node-appwrite SDK to create a table, the column payload looks like this:
[{"key":"email","type":"email","required":true, "size": 512}]
But I'm getting the error Invalid type for attribute 'email': email
Checking the appwrite source code, I see this as supported types: https://github.com/appwrite/appwrite/blob/a6d30130ba04e436ec46b8de4138af523079a8a2/src/Appwrite/Utopia/Database/Validator/Attributes.php#L23-L32
If I try to string as type it creates the table as expected, do we have missing types or I'm doing something wrong?
The docs example do the same as I'm doing
https://appwrite.io/docs/products/databases/tables
node-appwrite SDK: v26.2.0
<@1356535431834898634> can you take a look at this? 👀
Adding more information:
https://appwrite.io/docs/references/cloud/server-nodejs/tablesDB#createTable the documentation says:
Columns
Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
The response model for createTable define the columns with:
Table columns.
Can be one of:
ColumnBoolean model, ColumnInteger model, ColumnFloat model, ColumnEmail model, ColumnEnum model, ColumnURL model, ColumnIP model, ColumnDatetime model, ColumnRelationship model, ColumnPoint model, ColumnLine model, ColumnPolygon model, ColumnString model
Changing the type to string and adding the format param solves the problem, the issue is only in the documentation, as format isn't mentioned
There is any place where I can see all available types? for example I got an error if try to use text as column type, checking the source code I see the accepted values are:
Database::VAR_STRING
Database::VAR_INTEGER
Database::VAR_BIGINT
Database::VAR_FLOAT
Database::VAR_BOOLEAN
Database::VAR_DATETIME
Database::VAR_POINT
Database::VAR_LINESTRING
Database::VAR_POLYGON
so, I should use string, but string according to the docs it's deprecated: https://appwrite.io/blog/post/new-string-types
and the available formats doesn't include varchar, text, mediumtext or longtext
I'd love to have more information about my confusion. Just to make clear, I'm using the node-appwrite SDK with createTable
text should work, are you sure you're on the latest sdk?
here are the available types - https://appwrite.io/docs/products/databases/tables#columns
I'm using v26.2.0 (node-sdk) but the error is server side, checking the logs I see:
http.request · 11.6ms · 09cd46d4
level error
http.method POST
listener.usage.event Appwrite\Bus\Events\RequestCompleted
listener.usage.success true
http.path /v1/tablesdb/:databaseId/tables
http.response.code 400
Appwrite\Extend\Exception: Invalid type for attribute 'modulePath': text
at /usr/src/code/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php:145
at /usr/src/code/vendor/utopia-php/http/src/Http/Http.php:645
at /usr/src/code/vendor/utopia-php/http/src/Http/Http.php:864
at /usr/src/code/vendor/utopia-php/http/src/Http/Http.php:791
... 3 more
I'm using appwrite v1.9.5
hey can you try using the attribute creation methods instead of directly coupling with the tables
You mean use createTextColumn for example?
yes
Yes, that works without problem, it seems there is a bug in createTable
Hey <@1356535431834898634> there is any fix for this or a workaround to work while it's fixed?
Hey, sorry for the late reply A fix is created but prolly not released yet. Will message here once done
Till then you can use the individual column creation methods or appwrite cli for this where you will be maintaining schema through the appwrite config json
Recommended threads
- IMPORTANT! SOC-2 Request Failing
Issue requesting SOC-2. If tried other/private browser as well as filling in optional fields.
- Appwrite-injected variables are not avai...
I am using rust-1.83 as a runtime and try to access APPWRITE_FUNCTION_API_ENDPOINT or APPWRITE_FUNCTION_API_KEY during runtime. Both are not set during my execu...
- OAuth Missing redirect URL
Hello all, on a Flutter mobile app with latest Appwrite dependency (25.4.0) I always got "Missing redirect URL" - "Your OAuth login flow is missing a proper red...