T
Twenty2mo ago
Rob

Upgrade errors from v0.34 v0.35.1

Hi Twenty Team, Congratulations on the latest v0.35 release. I am excited to use the new favorites feature. I tried updating to v0.35.1 from v0.34.5. I pulled the latest images, updated the env vars, and ran yarn database:migrate:prod without error. However, when running yarn command:prod upgrade-0.35 I get the following error in the logs and I when I try and view the webui, I only see a skeleton load, and no views or data is visible. Appreciate any insight you can share on how to fix the problem, Thanks
19 Replies
Weiko
Weiko2mo ago
Hi @Rob The 0.33 version introduced unicity constraints in your tables. For example, a viewField should always be linked to a view so we are creating a unicity constraint on viewId inside the viewField table. It seems your workspace has legacy viewFields that have "NULL" as viewId. The upgrade command should have removed them so I'm surprised 🤔 Can you try to run yarn command:prod upgrade-0.33:delete-view-fields-without-views first? Otherwise can you delete them manually if it does not work? The 0.35 upgrade command should work after that
Rob
RobOP2mo ago
Hi @Weiko , thanks for the quick feedback. Your fix worked perfectly! Thank you
Weiko
Weiko2mo ago
Great 🙂
Raph
Raph2mo ago
Hey @Weiko a bit off topic, but is there a standard schema checker within the ORM? I would love to have a utility that would be available to run a sanity/health check on the schema from time to time. With the velocity of releases I do find it pretty easy to a migration to come up short. In fact I've experienced it myself once or twice.
Weiko
Weiko2mo ago
That's a very good point. Sadly no, we used to have one but it became less reliant with time because we were not updating it as fast as the rest. This is definitely something I want to work on early 2025. We have one last refactoring we want to implement first (simplifying how we handle relations, hopefully done soon)
Rob
RobOP2mo ago
Hi again @Weiko , I have found another errors that's occured since updating to v0.35 (I am now on v0.35.2). The error occurs when viewing my notes. The first set of notes displays correctly, but if i scroll down I get the error "Unexpected token P in JSON at position 0" . I took a screenshot of this error while the network console was open, incase that gives a clue to the underlying cause. The error does not occur in companies, people, or opportunities. I tried disabling various fields in the notes data model, but this did not stop the error from occuring. I was also able to reproduce the error by doing a graphql query of notes and using lastCursor. I do not get an error if I query notes without passing in a lastCursor. Thanks for your help!
No description
No description
Weiko
Weiko2mo ago
Thanks for the detailed explanations. I can't reproduce on my side, my guess is the RICH_TEXT that is part of a note (the "body" field, where you can type with blocks, images and such in your note) which is normally stored in JSON and can't be parsed correctly in your case I don't think this is related to pagination but probably because one of the notes on page n + 1 has a "corrupted" body Do you have many Notes with a body? If not, I would try 'soft deleting' them so they aren't returned by this view. Then see if that works, just to help narrow down the issue." Actually this could also come from pagination but I'd be surprised. Can you copy past the faulty last cursor?
Rob
RobOP2mo ago
Thanks for the help @Weiko. I disabled the "body" field in Notes. This did not fix the problem. However, the error now complains about the token T, not the token P (not sure if thats relevant or not. Here is the error...
{
"errors": [
{
"message": "Unexpected token T in JSON at position 0",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"response": "Unexpected token T in JSON at position 0"
}
}
],
"data": {
"notes": null
}
}
{
"errors": [
{
"message": "Unexpected token T in JSON at position 0",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"response": "Unexpected token T in JSON at position 0"
}
}
],
"data": {
"notes": null
}
}
Rob
RobOP2mo ago
Sorry, i dont quite understand what you want me to test here. Do you mean in the web ui or graphql call? Here is an example of a failed call if that helps (probably doesnt)
No description
Rob
RobOP2mo ago
But I do create notes via api calls sometimes, so it is possible that I created a malformed note somehow. If so, any tips on how to track it down in the database or via calls? Thanks
Weiko
Weiko2mo ago
Thank you, interesting Yes, the lastCursor value in your payload 🙂 Ah, that would be it indeed. Maybe you put simple "text" in the body payload when you created notes via API Here is how it typically looks like
[{"id":"becbf562-2027-47b7-94a2-28eb66921910","type":"paragraph","props":{"textColor":"default",....
[{"id":"becbf562-2027-47b7-94a2-28eb66921910","type":"paragraph","props":{"textColor":"default",....
So in your "note" table, I would check if one of the notes does not follow this format
Weiko
Weiko2mo ago
No description
Weiko
Weiko2mo ago
The first row here in my example is wrong (the one with position -168), it's not a JSON object so it won't be parsed correctly. Can you check your DB and identify those notes? If you find some, make a copy somewhere and empty the column to fix the loading of the page If you want to create notes via API and use body, you will need to follow RICH_TEXT format which is not trivial. We will try to improve that experience in the future. In the meantime you can also create your own custom field in the note object (in a text field setting you can set wrap to display all lines) and use that one instead.
Weiko
Weiko2mo ago
Something like this
No description
Weiko
Weiko2mo ago
Let me know if removing the body solved your issue
Rob
RobOP2mo ago
Hi @Weiko thanks for the help! You were right, there was a miss formed note body. I have about 1500 notes, and 800 of them are generated via graphql api calls. Not sure why one of 800 had a "P" before the "{". Thanks for your time, expertise, and help!!
Weiko
Weiko2mo ago
Great! 🙂
Rob
RobOP2mo ago
As an aside, I’ve created a really bad endpoint that accepts markdown and creates the body text. It doesn’t work very well haha. I’d love it if the Twenty API allowed me to pass plain text or markdown as input to create the body of a note. Probably not a high priority for web ui users.
thomast
thomast5w ago
Hi, at some point we want to enable RICH_TEXT type used in note body to be created from plain text. This is bellow our radar but as you guessed, not a huge priority 🙂

Did you find this page helpful?