Back

Cannot update attribute with SDK and set default value of it to null

  • 0
  • Databases
obiwanzenobi
25 Sep, 2023, 22:24

While using updateStringAttribute with this params (dart sdk)

TypeScript
    await _databases.get().updateStringAttribute(
      databaseId: ...,
      collectionId: ...,
      key: ...,
      xrequired: false,
      xdefault: null,
    );

I receive this error: general_argument_invalid, Param "default" is not optional. (400)

TL;DR
User is experiencing an error when trying to use the updateStringAttribute function with a null default value. They have tried setting the default value to an empty string and "[DEFAULT]", but the error persists. They are wondering if there is a solution for this issue. Solution: It seems that setting the default value to null is not allowed. Instead, try setting the default value to an empty string or a different non-null value.
Guille
26 Sep, 2023, 11:49

What is the SDK version?

obiwanzenobi
27 Sep, 2023, 11:09

10.0

darShan
27 Sep, 2023, 12:35

maybe try : xdefault: '[DEFAULT]'?

Thompson
27 Sep, 2023, 12:35

await _databases.get().updateStringAttribute( databaseId: ...,
collectionId: ...,
key: ...,
xdefault: '', // Set a default value (e.g., empty string) );

darShan
27 Sep, 2023, 12:43

Also make sure that you are on latest appwrite version. Sdk 10.0 is built against 1.4.3.

Drake
27 Sep, 2023, 21:19

oye...it would be good to create an issue for this

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more