Create Notion database page with multi-select property - error if empty

Describe the problem/error/question

I am syncing Github issues to Notion. Issue labels map to a Labels multi-select column in the Notion db.

Problem: if an issue is created with no labels, Notion throws an error. It’s absolutely fine to update the issue once it’s created with a label (remove all labels of an already synced GitHub issue syncs fine).

Both create and update nodes use the following expression to map labels:

{{$node["Trigger on issues"].json["body"]["issue"]["labels"].pluck("name")}}

What is the error message (if any)?

ERROR: Bad request - please check your parameters

body failed validation. Fix one: body.properties.Labels.multi_select[0].id should be defined, instead was `undefined`. body.properties.Labels.multi_select[0].name should be populated, instead was `""`.

Please share your workflow

I started with the Github → Notion template, to which I added sync of labels.

Many thanks in advance for any help you can provide!

Hey @gregzo,

Welcome to the community :raised_hands:

This is an interesting one, Because it is expecting data we will try and send it. Best thing to do is either use a ternary condition to set a default label like none set or use an if node before the notion node to check if the label exists first if it doesn’t don’t include it in the notion node and if it does include it.

1 Like

Hi @Jon , and thanks for the super quick reply! I’ve tried setting a default label, but the Notion API is expecting a bit more than just an array of strings it seems…

I’ll go down the conditional route for now. Would be great if there was a toggle on every prop to ignore if empty :slight_smile: Would you consider that?

Thanks again!

1 Like

Hey @gregzo,

Would always consider something like that, The tricky bit is making it look nice :slight_smile:

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