Upgrade to v0.33 sync of standard objects failed

Hi Team! I've just completed the migration from the old PostgreSQL image over to Spilo. I've restored my old database to the new Spilo container and everything is looking good (I think) except that I've seen errors that the metadata is missing it's version and the migration command to 0.33 is failing. Here are the images I'm using:
twentycrm_server_image = "twentycrm/twenty:v0.33.0" # Also used for worker image
twentycrm_db_image = "twentycrm/twenty-postgres-spilo:v0.33.0"
twentycrm_redis_image = "redis/redis-stack-server:latest"
twentycrm_server_image = "twentycrm/twenty:v0.33.0" # Also used for worker image
twentycrm_db_image = "twentycrm/twenty-postgres-spilo:v0.33.0"
twentycrm_redis_image = "redis/redis-stack-server:latest"
I've attached a screenshot of the errored logs as well hoping that it helps. When attempting to login, I do get a 500 server error (second screenshot)
No description
No description
37 Replies
Raph
Raph2mo ago
I can't see those screens.
Skyfox675
Skyfox675OP2mo ago
Sorry I was really hoping I could capture all of the output.. Here's what's left of my terminal scrollback for the migration script:
No description
Skyfox675
Skyfox675OP2mo ago
Here's the Server 500 generated on login:
No description
Raph
Raph2mo ago
what is your container health looking like? Also, what version did you upgrade from?
Skyfox675
Skyfox675OP2mo ago
All containers are up, no restarts, I don't have the worker running at the moment until the migration script has completed successfully. upgrading from: twentycrm/twenty:v0.32.3 -> twentycrm/twenty:v0.33.0 twentycrm/twenty-postgres:v0.32.3 -> twentycrm/twenty-postgres-spilo:v0.33.0
thomast
thomast2mo ago
@Skyfox675 did you follow https://twenty.com/developers/section/self-hosting/upgrade-guide#v0.32.0-to-v0.33.0 ? I think the schema has evolved between O.32 and 0.33. So only restoring your old DB will lead to schema errors
Skyfox675
Skyfox675OP2mo ago
I did do the update and scripts for 0.33
thomast
thomast5w ago
looking at your first screen, I see invalid input syntax for type json looks like this is trying to parse a note could you make sure all your notes have valid json bodies ? Or maybe just try without the notes just for testing
Skyfox675
Skyfox675OP4w ago
Is there a way to delete notes that might be cuasing issues? I've been hitting bugs with Note objects exceeding 8 nested items that I think broke the schema and would like to remove all notes that might be causing this
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
For now, probably only delete directly in database Also, could you write down how to replicate your problem? I'd like to reproduce it And if you're not sure how to delete it safely, feel free to ask
Skyfox675
Skyfox675OP4w ago
Yeah if you don't mind I would really appreciate help not mucking up a psql query with deletes. I'm thinking I could start by a delete where note char length is greater than 100 which should keep the basic (good quality notes that would be helpful to keep) and remove the lengthy broken JSON schemas of the test notes I was doing to inject form responses into notes
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
Do you maybe know about transactions in SQL?
Skyfox675
Skyfox675OP4w ago
I'm out running errands at the moment, what info can I provide to help you reproduce? I have a copy of my N8n "node" that is the JavaScript responsible for creating the looped note structure that apparently has the broken JSON I'm good fumbing through JOINs and inserts but WHERE with DELETES and DROPs make me pretty nervous lol
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
Okay, so here's a short explanation If you want to make some change but you're not sure about the query (like forgotten WHERE or wrong column), you can use transactions as a precaution In order to "enable" transaction mode, all you have to do is simply type BEGIN TRANSACTION; and then the "cursor" in your CLI changes from => to =*> After that, you can type whatever query you want, in order to revert your changes, you have to type ROLLBACK; And if you want to save your changes, you have to type COMMIT; Last thing, you can't revert committed changes
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
Does your notes look like this by any chance?
No description
Skyfox675
Skyfox675OP4w ago
So it might, but I can't view them via the UI it throws 500's and after the upgrade I can't login to the UI so hoping to get fixed so the UI can login, I can triage what else is going on from there The note structure is suppose to be multi-line (line 1 the form question, and line 2 the user response) but I found after 8 items in a note, it throws 500's and the note can only be deleted by API
Skyfox675
Skyfox675OP4w ago
This was the GH issue I opened for it a while back https://github.com/twentyhq/twenty/issues/7444
GitHub
Notes REST API (POST & PUT) - Internal Server Errors for all Notes ...
Bug Description Hi Team, After a while of debugging I found that when creating notes (or updating them) the maximum body length can be 8 items consisting of: { "type": "heading"...
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
Ah, no wonder I couldn't find this issue in open I guess I've made note with more than double the limit and app still works normally
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
I'd like to help you with testing the solution but now I've broke my local instance somehow and can't recover it 😆
No description
Skyfox675
Skyfox675OP4w ago
So I basically stopped using twenty when I encountered this and left it for a few months and left it in a broken state and just now making it a priority to fix it Think deleting the suspect notes that are exceeding long is a good first place to start?
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
It's worth trying for sure
Skyfox675
Skyfox675OP4w ago
Do you by chance know the table location of where the notes are stored?
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
workspace_<id>.note
Skyfox675
Skyfox675OP4w ago
Thank you! Am I safe to delete rows in that table or will there be broken references from doing so that might cause more problems?
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
I'd say you're safe deleting them Basically records in table are the same as records in UI
Skyfox675
Skyfox675OP4w ago
I'll work on this in the next few days, have a cert exam on Tuesday afternoon I should priortize 😦 Thank you for the help, seriously have been stuck, thank you
Skyfox675
Skyfox675OP3w ago
@ɃØĦɆᵾS I've gotten my notes table cleaned up and gone through each note I've kept to double check it has valid syntax. These are the errors I'm seeing now in the yarn command:prod upgrade-0.33 command:
WARN [SyncWorkspaceMetadataCommand] Workspace health check failed with error, but sync has been forced.
WARN [SyncWorkspaceMetadataCommand] NotFoundException: Table viewGroup not found in schema workspace_1txac8c4raz2nkwk4mmgyf4b3
WARN [SyncWorkspaceMetadataCommand] Workspace health check failed with error, but sync has been forced.
WARN [SyncWorkspaceMetadataCommand] NotFoundException: Table viewGroup not found in schema workspace_1txac8c4raz2nkwk4mmgyf4b3
ɃØĦɆᵾS
ɃØĦɆᵾS3w ago
Sadly I don't have enough knowledge about upgrading process to help you, @thomast could you take a look?
thomast
thomast3w ago
Looks like it now complains about the json in a task 😅
Skyfox675
Skyfox675OP2w ago
Oh goodness, ok going to run through those now
Skyfox675
Skyfox675OP2w ago
Weird, dozens of empty bodied tasks, I ended up just deleting all tasks lol Thanks @thomast that looks like that did the trick 🙂 successful sync (I think?), showing 43 errors that exist after the successful run of yarn command:prod upgrade-0.33 Is there anything I need to do before I bump the container images up to 0.34?
No description
thomast
thomast2w ago
Glad that worked! Make sure to follow https://twenty.com/developers/section/self-hosting/upgrade-guide#v0.33.0-to-v0.34.0 and I hope it will be easier this time!
Skyfox675
Skyfox675OP2w ago
Looks like the server is still having issues. It looks like all of my custom objects are failing to return and the UI is on a coffee break with t is undefined
No description
No description
thomast
thomast2w ago
@charles have you already seen that error? 🤔
Skyfox675
Skyfox675OP2w ago
FYI I haven't upgraded yet, still sitting on v0.33, I'm able to login now (I wasn't before with the previous errors) and I do see all of these custom object types on the left nav bar, but clicking on them or any object including the default ones returns these errors above I'm honestly considering starting over 😕 I don't know if it's reason to consider it, but it's been down so long at this point, not sure if there's anything worth recovering. I liked the schema/object structures I've setup though so it would be nice to not have all of that wasted
thomast
thomast7d ago
Hi @Skyfox675, that could indeed be a solution because every time we fix something we just reach another issue 😅 You do have a complex schema, hard to setup again? do you have a table named automation? looks like this is the one that is failing if you have, the step to debug would be to: - dive into the code to reach the query that is done in postgres - log the query - try to run the query by itself to understand the issue If you don't have an automation custom object, this is the actual issue. We need to understand why this query is done
Skyfox675
Skyfox675OP6d ago
@thomast @bob thank you both for your help, after a few drinks 🍷 and a long talk with @xSwampxFox we decided to just backup data and nuke the instance and start over lol we're on 0.42.15 now and up and running again and will be working on the data load and rebuilding the schema in the next week or so. Thanks again for helping us try to recover it

Did you find this page helpful?