Notes are Throwing Errors: Cannot read properties of null (reading 'map')

I have been creating notes and their targets (companyId & opportunityId) via the REST API. Successfully too, as I have been getting this back: [ { "data": { "createNote": { "updatedAt": "2025-07-03T07:10:04.278Z", "deletedAt": null, "position": 0, "title": "", "body": null, "bodyV2": { "blocknote": "null", "markdown": "abcdefg" .... But when I go to the notes section, it doesn't show me anything and I get this error message: Cannot read properties of null (reading 'map'). Disclosure: I'm a somewhat tech-savvy business user, so I don't know what to do here :-). Any advice?
18 Replies
Prastoin
Prastoin3mo ago
Mhmm sounds like server side validation issue Could you please share the whole request so I can give this a try locally ?
BigKahuna
BigKahunaOP3mo ago
Sure. Here are my two calls: 1) createNotes (/rest/notes)
{
"updatedAt": "2025-07-04T18:27:19.634Z",
"deletedAt": null,
"position": 0,
"title": "myTitle",
"body": null,
"bodyV2": {
"blocknote": "null",
"markdown": "myText"
},
"createdBy": {
"source": "API",
"workspaceMemberId": null,
"name": "n8n",
"context": {}
},
"searchVector": "lotsOfVectors",
"id": "93aa4a29-cd0d-4950-8b7e-6b8c2a0a0e94",
"createdAt": "2025-07-04T18:27:08.000Z"
}
{
"updatedAt": "2025-07-04T18:27:19.634Z",
"deletedAt": null,
"position": 0,
"title": "myTitle",
"body": null,
"bodyV2": {
"blocknote": "null",
"markdown": "myText"
},
"createdBy": {
"source": "API",
"workspaceMemberId": null,
"name": "n8n",
"context": {}
},
"searchVector": "lotsOfVectors",
"id": "93aa4a29-cd0d-4950-8b7e-6b8c2a0a0e94",
"createdAt": "2025-07-04T18:27:08.000Z"
}
` 2) createNoteTarget (/rest/noteTargets)
{
"createNoteTarget": {
"id": "e2dcd6cd-8ea0-42b0-a96a-47d62e4ea1f5",
"createdAt": "2025-07-04T18:27:19.728Z",
"updatedAt": "2025-07-04T18:27:19.728Z",
"deletedAt": null,
"noteId": null,
"personId": null,
"companyId": "c2a67d17-5923-4f77-874b-c75c3bdd04d6",
"opportunityId": "c444e9eb-1901-4673-89e5-5389f6e3b12c"
}
}
{
"createNoteTarget": {
"id": "e2dcd6cd-8ea0-42b0-a96a-47d62e4ea1f5",
"createdAt": "2025-07-04T18:27:19.728Z",
"updatedAt": "2025-07-04T18:27:19.728Z",
"deletedAt": null,
"noteId": null,
"personId": null,
"companyId": "c2a67d17-5923-4f77-874b-c75c3bdd04d6",
"opportunityId": "c444e9eb-1901-4673-89e5-5389f6e3b12c"
}
}
`
Prastoin
Prastoin3mo ago
On it Hey @BigKahuna from my understanding you need to pass a value to bodyV2.blocknote section Such as with
{
"idToUpdate": "4a78d88a-dcd6-4d02-b42a-937e819e9f21",
"input": {
"bodyV2": {
"blocknote": "[{\"id\":\"e70c3dee-4f66-46e8-b111-13e3fc1096d3\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"prastoin test\",\"styles\":{}}],\"children\":[]},{\"id\":\"60929edf-595f-4631-aba0-cfd8402929f8\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[],\"children\":[]},{\"id\":\"9c513fe5-0dec-4dea-8a27-40e0f04470c7\",\"type\":\"heading\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\",\"level\":1},\"content\":[{\"type\":\"text\",\"text\":\"Something like that\",\"styles\":{}}],\"children\":[]},{\"id\":\"297c8118-95f7-47e0-a9e1-caa7702713d0\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[],\"children\":[]},{\"id\":\"3aa2559b-3de2-469e-829b-59e4d4b4426c\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"and something like that too\",\"styles\":{\"code\":true}}],\"children\":[]},{\"id\":\"876f45ff-ba51-4c12-b1b2-84885e01c1b1\",\"type\":\"codeBlock\",\"props\":{\"language\":\"text\"},\"content\":[{\"type\":\"text\",\"text\":\"wdowidwoiudw/\",\"styles\":{}}],\"children\":[]},{\"id\":\"da5711ac-6ac6-4d74-808a-6da9b3b35e31\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[],\"children\":[]}]",
"markdown": null
}
}
{
"idToUpdate": "4a78d88a-dcd6-4d02-b42a-937e819e9f21",
"input": {
"bodyV2": {
"blocknote": "[{\"id\":\"e70c3dee-4f66-46e8-b111-13e3fc1096d3\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"prastoin test\",\"styles\":{}}],\"children\":[]},{\"id\":\"60929edf-595f-4631-aba0-cfd8402929f8\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[],\"children\":[]},{\"id\":\"9c513fe5-0dec-4dea-8a27-40e0f04470c7\",\"type\":\"heading\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\",\"level\":1},\"content\":[{\"type\":\"text\",\"text\":\"Something like that\",\"styles\":{}}],\"children\":[]},{\"id\":\"297c8118-95f7-47e0-a9e1-caa7702713d0\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[],\"children\":[]},{\"id\":\"3aa2559b-3de2-469e-829b-59e4d4b4426c\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"and something like that too\",\"styles\":{\"code\":true}}],\"children\":[]},{\"id\":\"876f45ff-ba51-4c12-b1b2-84885e01c1b1\",\"type\":\"codeBlock\",\"props\":{\"language\":\"text\"},\"content\":[{\"type\":\"text\",\"text\":\"wdowidwoiudw/\",\"styles\":{}}],\"children\":[]},{\"id\":\"da5711ac-6ac6-4d74-808a-6da9b3b35e31\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[],\"children\":[]}]",
"markdown": null
}
}
You're getting map not defined because bodyV2.blockNote shouldn't be nullable Seems to be a twenty-server lack of validation here Regarding the targetNote unless I'm mistaken we've seen that together already ? The markdown property seems to be computed by the server
"bodyV2":{3 items
"__typename":"RichTextV2"
"blocknote":"[{"id":"e70c3dee-4f66-46e8-b111-13e3fc1096d3","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"prastoin test","styles":{}}],"children":[]},{"id":"60929edf-595f-4631-aba0-cfd8402929f8","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]},{"id":"9c513fe5-0dec-4dea-8a27-40e0f04470c7","type":"heading","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left","level":1},"content":[{"type":"text","text":"Something like that","styles":{}}],"children":[]},{"id":"297c8118-95f7-47e0-a9e1-caa7702713d0","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]},{"id":"3aa2559b-3de2-469e-829b-59e4d4b4426c","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"and something like that too","styles":{"code":true}}],"children":[]},{"id":"876f45ff-ba51-4c12-b1b2-84885e01c1b1","type":"codeBlock","props":{"language":"text"},"content":[{"type":"text","text":"wdowidwoiudw/","styles":{}}],"children":[]},{"id":"da5711ac-6ac6-4d74-808a-6da9b3b35e31","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]}]"
"markdown":"prastoin test # Something like that `and something like that too`
"bodyV2":{3 items
"__typename":"RichTextV2"
"blocknote":"[{"id":"e70c3dee-4f66-46e8-b111-13e3fc1096d3","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"prastoin test","styles":{}}],"children":[]},{"id":"60929edf-595f-4631-aba0-cfd8402929f8","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]},{"id":"9c513fe5-0dec-4dea-8a27-40e0f04470c7","type":"heading","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left","level":1},"content":[{"type":"text","text":"Something like that","styles":{}}],"children":[]},{"id":"297c8118-95f7-47e0-a9e1-caa7702713d0","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]},{"id":"3aa2559b-3de2-469e-829b-59e4d4b4426c","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"and something like that too","styles":{"code":true}}],"children":[]},{"id":"876f45ff-ba51-4c12-b1b2-84885e01c1b1","type":"codeBlock","props":{"language":"text"},"content":[{"type":"text","text":"wdowidwoiudw/","styles":{}}],"children":[]},{"id":"da5711ac-6ac6-4d74-808a-6da9b3b35e31","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]}]"
"markdown":"prastoin test # Something like that `and something like that too`
text wdowidwoiudw/
"
}
"
}
So from my understanding we're expecting the caller to send a blocknote js data format 🤔 which mean we expect him to have the dep, that's not the smoothest thing @Lucas do you have more information regarding that please ?
Lucas
Lucas3mo ago
It seems strange that we expect a user to pass a blocknote JSON, @BigKahuna where do the data come from ? Is it an import from a previous Twenty export or does it come from another manually crafted file ? It seems more relevant to pass either markdown either raw text, both should go to markdown property anyway We may have to create a path for API and separate it from our current path for GraphQL
BigKahuna
BigKahunaOP2mo ago
Hi, @Prastoin @Lucas. Thanks for looking into this. To answer the questions: I am exporting my Pipedrive notes here, which are kept in HTML and I am manually converting them to markdown for compatibility. Thus I am only inserting my markdown in bodyV2 and blocknote remains empty. And I can, in fact, create notes that way and fetch them via the API. I just get these Cannot read properties of null (reading 'map') errors when trying to view all people, companies or opportunities (of which some are linked to a note). When I was exporting my tasks, on the other hand, I just inserted the task title in blocknote and that seemed to work well enough to not cause any errors. I'll try inserting a hard coded text to see if that helps with notes too.
Lucas
Lucas2mo ago
Could you share a file with a line of anonymized data that matches the structure of what you send to the API ? It seems that what you shared is the return of the calls isn’t it ?
BigKahuna
BigKahunaOP2mo ago
Sure (and you're right), here's an example of my call. Create individual note:
{
"createdBy": "8cc6d991-5634-4761-9fdd-14462b9fd6e7",
"bodyV2.blocknote": "null",
"bodyV2.markdown": "my long markdown note text as json string",
"createdAt": "2017-03-01T10:55:30.000+01:00",
"title": "title"
}
{
"createdBy": "8cc6d991-5634-4761-9fdd-14462b9fd6e7",
"bodyV2.blocknote": "null",
"bodyV2.markdown": "my long markdown note text as json string",
"createdAt": "2017-03-01T10:55:30.000+01:00",
"title": "title"
}
Create note targets for all notes at once:
{
"noteId": "0e7cd135-cac2-4e69-a7c8-7b70612502c9",
"companyId": "446ebfb0-4929-43cb-b6e7-1f2c15a217a4",
"personId": "9f6471f3-a979-49f6-b00f-315f6e3b4a0d"
},
{
"noteId": "058ad7ea-155e-4ce8-b5f8-2954854c0890",
"companyId": "446ebfb0-4929-43cb-b6e7-1f2c15a217a4",
"personId": "4d0b3121-c02f-41a8-a43a-3d071a3bd3b0"
},
{
"noteId": "43b76e80-8a4e-4138-b098-aa99e26b4686",
"companyId": "446ebfb0-4929-43cb-b6e7-1f2c15a217a4"
}
]
{
"noteId": "0e7cd135-cac2-4e69-a7c8-7b70612502c9",
"companyId": "446ebfb0-4929-43cb-b6e7-1f2c15a217a4",
"personId": "9f6471f3-a979-49f6-b00f-315f6e3b4a0d"
},
{
"noteId": "058ad7ea-155e-4ce8-b5f8-2954854c0890",
"companyId": "446ebfb0-4929-43cb-b6e7-1f2c15a217a4",
"personId": "4d0b3121-c02f-41a8-a43a-3d071a3bd3b0"
},
{
"noteId": "43b76e80-8a4e-4138-b098-aa99e26b4686",
"companyId": "446ebfb0-4929-43cb-b6e7-1f2c15a217a4"
}
]
So what I just tried was to add the title-value to the blocknote-variable and suddenly: Things worked. Well: Except for the fact that I can't see the markdown body of my notes that I was expecting :-(. Where did that go?
BigKahuna
BigKahunaOP2mo ago
No description
BigKahuna
BigKahunaOP2mo ago
@Lucas @Prastoin I re-discovered this old ticket here: https://github.com/twentyhq/twenty/issues/10606 It describes EXACTLY the error I am seeing (now that I am providing a text for the blocknote variable). I tried to add a blocknote text to the blocknote variable and suddenly I was getting a body text that was also visible in the UI. But I'm a bit clueless on how to transform my markdown text to blocknote. Just making it the value of my blocknote variable does not magically convert it to blocktext (that would have been nice).
GitHub
Note body not visible when via API with bodyV2 without blocknote ·...
Bug Description Creating a note via API with bodyV2 and without a blocknote component will not allow the body component to be visible in the UI despite a successful API call. Inputting markdown tex...
Prastoin
Prastoin2mo ago
I agree with you we have clearly transpilation improvements to make on server side validation/transformation steps is the response bodyV2.markdown null here ?
BigKahuna
BigKahunaOP2mo ago
No. blocknote is null, markdown has actual markdown text
Prastoin
Prastoin2mo ago
We've created a bug ticket to finalize the blockNote v2 migration https://github.com/twentyhq/twenty/issues/13110, it will be assigned next monday at the start of the next sprint We will take care to create integration test on both REST and graphQl API to assert it's working as expected I think we can also improve the expected format to be more flexible either already parsed as blocknote format or raw markdown etc this will be discussed
GitHub
twentyhq/twenty
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
BigKahuna
BigKahunaOP2mo ago
Uhm, another quick question (since I just experimenting a little for the fun of it): Am I meant to be able to provide "updatedAt" with a certain value via the API? Because I actually can (that was unexpected). But, of course, that causes an error in the UI too. How long are your sprints usually? Two weeks?
Prastoin
Prastoin2mo ago
Yes, if we end up to fix it earlier I will publish a docker image in the hub for you I don't think that's intented, creating a bug thanks What would be annoying is if you can set the deletedAt 🤔 Will create TDD integrations tests and open an issue with related information depending on the situation, tomorrow morning
BigKahuna
BigKahunaOP2mo ago
That would be grand. I just checked: Two weeks is just 1 day shy of our next pipedrive billing cycle on the 26th 😂
Prastoin
Prastoin2mo ago
Will try to find a workaround way before so you can plan things easily Blocking tomorrow morning for support anw So I've investigated the issue it seems like that blocknote transpilation from raw markdown to blocks is lossy Could you please send me a raw markdown you're having issue with ? On my side was only able to reproduce partial rendering but never none
BigKahuna
BigKahunaOP2mo ago
I have a few examples, but there is nothing special about them really. E.g.: "In xxx bei virtualitee Messe kennegelernt / yyy in Paris" Or: "xxx ist ein yyy aus Paris. \n\nSie haben bereits zzz etc. lizensiert.\n\nDer Account passt nicht in unser ICP." Hi, Prastoin. Is there any update on this issue?
Prastoin
Prastoin2mo ago
Hey @Félix, sorry for the dispatch but would please mind having a look to this when you have some free time ? Unfortunately I don't have time to re-check In a nutshell Kahuna when hitting the api to insert blockNote, sometimes result in nothing displayed in the notes within the client As we've been talking about in DM I've indeed been able to reproduce a lossy migration from markdown to block but never a complete loss resulting in nothing displayed in the UI

Did you find this page helpful?