Back

Error 400 (Bad Request)

  • 0
  • Web
  • Databases
  • Storage
  • Self Hosted
  • Functions
ideclon
29 Dec, 2023, 04:39

Looks like you're still not passing an image key

TL;DR
Error 400 (Bad Request) occurs when trying to create a document in a database. Initially, the error was due to a missing attribute called "image", but now the error is stating that the "image" attribute has an invalid URL format. Changing the attribute name from "imageUrl" to "image" did not resolve the issue. It is suggested to change the attribute name in the appwrite configuration or in the code. Additionally, it is noted that the value of "fileUrl" should be a string, not an object. The screenshot of the list of attributes from the Appwrite Console is requested to further troubleshoot the issue
Drake
29 Dec, 2023, 04:45

Would you please switch to the payload tab and share that

rmn
30 Dec, 2023, 02:22

I don’t know why, I think I did?

rmn
30 Dec, 2023, 02:23

Hold on yeah, sorry for the delayed replies, busy with work over the weekend

rmn
30 Dec, 2023, 02:24

here you are

rmn
30 Dec, 2023, 02:25

imageUrl is empty

rmn
30 Dec, 2023, 02:25

but i think my code passes it as an image though

rmn
30 Dec, 2023, 02:25

not sure why it isnt registering

Drake
30 Dec, 2023, 05:13

As I said earlier, you can't pass an image...

Anyways, what collection has an image attribute?

rmn
31 Dec, 2023, 03:10

The Posts collection

Drake
31 Dec, 2023, 05:06

Would you please share a screenshot of the list of attributes of the posts collection from the Appwrite Console?

rmn
3 Jan, 2024, 17:17

sorry i did not get the notification for this

rmn
3 Jan, 2024, 17:17

my discord has been acting up

rmn
3 Jan, 2024, 17:17

sure

rmn
3 Jan, 2024, 17:18
k_vasen
3 Jan, 2024, 17:46

I can see you have set a attribute with a name 'image' and type as URL. But you have tried to pass this attribute in code as imageUrl

k_vasen
3 Jan, 2024, 17:47

Here you're passing imageUrl key of your data. You can change that to image. Btw The value of fileUrl is a object. It should be a string I guess.

rmn
4 Jan, 2024, 03:04

Tried changing this and it still didn’t work, I thought so initially too

rmn
4 Jan, 2024, 03:04

Should I change it in appwrite or code

ideclon
4 Jan, 2024, 03:15

You changed imageUrl to image in your databases.createDocument() function, and it still gives an error that image is missing?

rmn
4 Jan, 2024, 07:41

yep, same output

rmn
4 Jan, 2024, 07:41
rmn
4 Jan, 2024, 07:41
ideclon
4 Jan, 2024, 12:02

No, that’s a different error

ideclon
4 Jan, 2024, 12:04

Before it was complaining Invalid document structure: Missing required attribute: “image”. Now the error is Attribute “image” has invalid format: Value must be a valid URL.

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