Back

[SOLVED] AppwriteException: Invalid document structure: Attribute "color" has invalid type.

  • 0
  • Web
bharath
4 Apr, 2023, 15:36

AppwriteException: Invalid document structure: Attribute "color" has invalid type. Value must be a valid string and no longer than 100 chars

TL;DR
The issue is resolved, as the original message was deleted. The error is due to sending 'color' as an object instead of a string. To fix it, change the value to a string.
bharath
4 Apr, 2023, 15:36

once check my code

joeyouss
4 Apr, 2023, 15:38

so when radio button selects a value -> you should be sending that back to update the DB about the color, empty string will be replaced by your color. I do not think the updation is happening and hence, it is showing error?

bharath
4 Apr, 2023, 15:38

then what should i change in my code

bharath
4 Apr, 2023, 15:52
TypeScript
    props.setSelectedValue(event.target.value);
    database({
      color:''
    }).then(function (response) {
          console.log(response);
      }, function (error) {
          console.log(error);
      });
}
const handleChange2 = (event)=>{
  props.setSelectedValue2(event.target.value);
  database(
    {
      side:''
    }
    ).then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
}```
Binyamin
4 Apr, 2023, 16:04

What logs you get for this part?

TypeScript
database({
      color:''
    }).then(function (response) {
          console.log(response);
      }, function (error) {
          console.log(error);
      });
bharath
4 Apr, 2023, 16:05

black and white

bharath
4 Apr, 2023, 16:05

Or

bharath
4 Apr, 2023, 16:05

Color

Binyamin
4 Apr, 2023, 16:05

What is the log of the database function

bharath
4 Apr, 2023, 16:06

What is log

bharath
4 Apr, 2023, 16:06

Do you mean console log

Binyamin
4 Apr, 2023, 16:06

Yes

bharath
4 Apr, 2023, 16:07

Users radio button input

Binyamin
4 Apr, 2023, 16:07

Do you get error when running the database function?

bharath
4 Apr, 2023, 16:08

Yes

Binyamin
4 Apr, 2023, 16:08

What is the error?

bharath
4 Apr, 2023, 16:08
Binyamin
4 Apr, 2023, 16:09

Show me the payload inside the network tab

bharath
4 Apr, 2023, 16:10

Ok

bharath
4 Apr, 2023, 16:13
bharath
4 Apr, 2023, 16:14

here it is

Binyamin
4 Apr, 2023, 16:18

Okay, you're sending color as an object when it is a string Just change the value to string and you're good to go

Tessa
7 Apr, 2023, 21:12

closing as original message was deleted so i think it was resolved

Tessa
7 Apr, 2023, 21:13

[SOLVED] AppwriteException: Invalid document structure: Attribute "color" has invalid type.

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