Back

Server Error while creating new document from appwrite function

  • 0
  • Functions
Nimit Savant
28 May, 2023, 17:40

I was trying to create a new document in Appwrite Database, it was working fine but suddenly started giving me "Server Error" I've self hosted on version 1.3.1

TL;DR
The user encountered a server error while trying to create a new document in the Appwrite database. They tried deleting and recreating an attribute, but it did not solve the issue. Another user suggested modifying the attribute length directly in the database. The user later found a GitHub issue related to their problem and agreed to create a new issue. There was a suggestion to not add ENUMs longer than the highest length already present in the attribute. The user eventually resolved the issue after upgrading Appwrite to version 1.3.4 and running the migrate command. They also shared a link to access logs for debugging purposes.
Drake
28 May, 2023, 18:47

Check the docker logs for your appwrite container

Nimit Savant
28 May, 2023, 20:44

what is the command for that?

Drake
28 May, 2023, 20:53
Nimit Savant
28 May, 2023, 20:53

done

Nimit Savant
28 May, 2023, 20:53

I can now add from console

Nimit Savant
28 May, 2023, 20:53

but still getting the same error in from function

Nimit Savant
28 May, 2023, 20:54

Only SMTP is down, because I've configured it

Drake
28 May, 2023, 20:55

Make sure you're looking at logs for the right container and then find the log entry related to the server error

Nimit Savant
28 May, 2023, 20:55

Which container I should look for in this case?

Drake
28 May, 2023, 20:55

Btw, you should really upgrade Appwrite to 1.3.4 and run the migrate command

Nimit Savant
28 May, 2023, 20:56

umm understood, I was just thinking about this.

Nimit Savant
28 May, 2023, 21:16

I understood the error, but why this error. paymentStatus is an enum. And I added a new Enum by editing this attribute, which was a bit long than the others. Do you think mariadb registered the following enum length and now any enum greater than that length would be forbidden?

Nimit Savant
28 May, 2023, 21:17

done \✅

Nimit Savant
28 May, 2023, 21:19

ahh its working now, this was the issue YES.

Nimit Savant
28 May, 2023, 21:22

Steven, we should tell people to not add Enums greater than the highest length already present in that attribute. eg: paymentStatus Attrib has

  • 3 Enums: Success - Pending - Failure
  • if I edit this attrib and add Intiated this won't work, because mariaDB has already taken the highest length of Pending and Failure that is 7.
Drake
28 May, 2023, 21:34

Would you please create an issue for this?

Nimit Savant
28 May, 2023, 21:52

tomorrow morning first thing :)

Nimit Savant
29 May, 2023, 06:44
Bouahaza
29 May, 2023, 07:41
Bouahaza
29 May, 2023, 07:45

@Nimit Savant While you're waiting for a fix, you can modify the attribute length by editing the field directly in the database.

Nimit Savant
29 May, 2023, 07:46

oops

Nimit Savant
29 May, 2023, 07:47

yes but I'll have to go into mariabDB and do that, I found a fix. I deleted the attribute and made it again

Bouahaza
29 May, 2023, 07:47

Without data you can also do that yes

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