T
Twenty3mo ago
Rob

v0.33.3: TypeError: Cannot read properties of undefined (reading 'fieldMetadataId')

Congratulations on the 0.33 release. I am excited to use the multi select filter! I upgraded with no issues, following the insturctions at https://github.com/twentyhq/twenty/blob/main/packages/twenty-website/src/content/developers/self-hosting/upgrade-guide.mdx#v0320-to-v0330 there were no errors in my update log. After upgrading the API interface works. However, in the web interface I am geting the error TypeError: Cannot read properties of undefined (reading 'fieldMetadataId') Has anyone else experienced this (@ɃØĦɆᵾS )? Does anyone know what might have gone wrong and how i can fix it? Thanks!
GitHub
twenty/packages/twenty-website/src/content/developers/self-hosting/...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
No description
24 Replies
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
Oh, I experienced that one I resolved this by simply restarting database since I don't have any important data
Rob
RobOP3mo ago
Thanks. Unfortunately I have a years worth of data to protect 🙂 I launced an issue, thanks. https://github.com/twentyhq/twenty/issues/8693
GitHub
fieldMetadataId error after upgrading to v0.33.3 · Issue #8693 · tw...
Bug Description Congratulations on the 0.33 release. I am excited to use the multi select filter! I upgraded with no issues, following the insturctions at https://github.com/twentyhq/twenty/blob/ma...
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
That's understandable
Rob
RobOP3mo ago
thanks for confirming mate
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
I'll try to reproduce it somehow, tbh didn't bother with reporting it as I thought it's something on my side No problem
Weiko
Weiko3mo ago
Hi @Rob something went wrong with the upgrade command most likely. Do you have access to the DB? Can you check if you have any viewField rows that have a viewId as null?
Rob
RobOP3mo ago
will look now! should i look in any table in particular?
Weiko
Weiko3mo ago
you should look at your workspace schema (the one starting with workspace_*) and the viewField table
Rob
RobOP3mo ago
thanks. And for your records/debugging, here the update log
Rob
RobOP3mo ago
@Weiko you were correct, many rows have viewid as null
No description
Rob
RobOP3mo ago
any suggestions how to fix this?
Weiko
Weiko3mo ago
Ok. This is from legacy code and we clearly missed that, viewFields should always be linked to views by now and should have been for a while. Because of this, the "EnforceUniqueConstraints" step in the 0.33 upgrade messed up your table. As you can see, the command interpreted all your viewFields as duplicates and soft deleted them (deletedAt is not NULL). I'd suggest you restore those by updating the "deletedAt" colomn to NULL for all those records and your page should load again
Rob
RobOP3mo ago
thanks for the insight! how can i set all the deletedAt column to NULL? Do we need to fill in the viewID column with data and not Nulls?
Weiko
Weiko3mo ago
UPDATE "YOUR_SCHEMA"."viewField" SET "deletedAt"=NULL;
UPDATE "YOUR_SCHEMA"."viewField" SET "deletedAt"=NULL;
should be good
Rob
RobOP3mo ago
and YOURSCHEMA would be "workspace_6irr16qioalagnvc5ffeneuhx" in this situtaion?
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
Yes
Weiko
Weiko3mo ago
Yes 🙂 No actually that's the issue, they shouldn't be there in the first place, I suggest you delete them. I guess you won't be the only one affected, we need to land a patch with a command that should sanitize the table before the EnforceUniqueConstraints step
Rob
RobOP3mo ago
So i should delete the column somehow?
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
Just null all records
Rob
RobOP3mo ago
null the viewwID records too?
Weiko
Weiko3mo ago
Let's not delete anything for now, just update the deletedAt row and see how it goes 🙂 (with the SQL query above)
Rob
RobOP3mo ago
it seems to be working!! I will investigate more and report back in a few hours thanks for the help!!!
Weiko
Weiko3mo ago
Great 👍
Rob
RobOP3mo ago
I have been using the setup for a while and haven't hit this error again. Thanks @Weiko

Did you find this page helpful?