Null value in Notion Node causing Error

Describe the issue/error/question

When trying to set the value of a property to null (i.e. delete the value) an error occurs

What is the error message (if any)?

Please share the workflow

Very simply, {{null}} is passed within the expression:

Referring to the notion API, the value needs to be set to null to clear a property. Of course you cannot simply enter ‘null’ as this will be taken as a literal string and the property value will then literally be null rather than nothing as needed.

Null Values for Notion API discussed here on stack: Clearing Date object using Notion API? - Stack Overflow

Share the output returned by the last node

Please see error above

Hey @pb84

I am sorry to say it but now n8n does NOT support clearing date property, what I can suggest is set some weird date like year 2599 and then tract this date same as empty in filters.
Read more here: Notion clear date - #2 by RicardoE105

You can clear properties by leaving them empty. I just tested it with dates, and it worked fine. Make sure you are using version 2. To do that, add the node from the nodes menu instead of copying the node from another workflow/


Oh, really? I did not know, sorry for misleading ;/

Re-opening this issue to extend to the case of database relations:

If, as shown in the image above, you pass an empty value into a relation, it causes an error.

Note that this is necessary - the workflow I am building will not know in advance which properties will be needed to be added to the Notion Database page.

Is there a way around this issue?

I have also tried @jan’s method of:

{{$json[] || null}}

but as established above, null doesn’t seem to work anymore with notion

Just in case this old thread doesn’t show up:

Hey @pb84,

What happens if you just don’t include that field? Does it still fail?

Getting the same error, I’m afraid when left blank.

I suspect (although I could be incorrect, and there could be a way of preventing this) that when you hit Add Item, this creates an object for this database field in the POST request, and therefore, no entry causes an issue. Hopefully, there is a workaround, but if not, perhaps the notion node could be updated so that if there is nothing in the relation field (as above), then no object is generated?

Hey @pb84,

So you got that without having the Meetings field in there at all? I wouldn’t have expected Notion to complain unless it is set as a required field but I am not sure if that is possible.

I take it notion allows you to manually add a record without including the ID as well?

Ah no so I did have the meetings field - it was just blank (nothing inside)

It does work fine if you delete that field, but I guess that the point is for it to be filled variably based on the input and if it’s deleted altogether no dice.

Does that make sense?

For now I’ve just built a custom function w js in an http node.

Also a note to @jan Notion date in the http headers is currently out of date (they have a newer release for 22-06-28) which allows the get requests to pull more information

Hey @pb84,

I have have had a play and I can see the issue now, So if you don’t have an input that is a uuid you want to send nothing in that field.

It looks like when we handle the relation field we do a split and that looks to be failing so maybe we just need an “empty” option.

As a workaround what I would do is just pop an If before it and if the incoming field is empty go to a second notion node that doesn’t have that field set or add it to a list to be manually checked and if it set populate like normal.

With the version header I will add it to the internal request list and next time we change something in the node we can take a look at changing it.

Yep an empty toggle that can be activated by way of expression would be awesome.

For now will abuse the function node with js

1 Like

Hi Guys - any luck implementing this?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.