Skip to content

Commit

Permalink
Add common issues to Notion node
Browse files Browse the repository at this point in the history
  • Loading branch information
imchairmanm committed Dec 20, 2024
1 parent 867f6e5 commit c572977
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
#https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
title: Notion node common issues
description: Documentation for common issues and questions in the Notion node in n8n, a workflow automation platform. Includes details of the issue and suggested solutions.
contentType: integration
priority: high
---

# Notion node common issues

Here are some common errors and issues with the [Notion node](/integrations/builtin/app-nodes/n8n-nodes-base.notion/) and steps to resolve or troubleshoot them.

## Relation property not displaying

The Notion node only supports displaying the data relation property for [two-way relations](https://www.notion.com/help/relations-and-rollups). When you connect two Notion databases with a two-way relationship, you can select or filter by the relation property when working with the Notion node's **Database Page** resource.

To enable two-way relations, edit the relation property in Notion and enable the **Show on [name of related database]** option to create a reverse relation. Select a name to use for the relation in the new context. The relation is now accessible in n8n when filtering or selecting.

If you need to work with Notion databases with one-way relationship, you can use the [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/) with your existing Notion credentials. For example, to update a one-way relationship, you can send a `PATCH` request to the following URL:

```
https://api.notion.com/v1/pages/<page_id>
```

Enable **Send Body**, set the **Body Content Type** to **JSON**, and set **Specify Body** to **Using JSON**. Afterward, you can enter a JSON object like the following into the **JSON** field:

```json
{
"properties": {
"Account": {
"relation": [
{
"id": "<your_relation_ID>"
}
]
}
}
}
```

## Create toggle heading

The Notion node allows you to create headings and toggles when adding blocks to **Page**, **Database Page**, or **Block** resources. Creating toggleable headings isn't yet supported by the Notion node itself.

You can work around this be creating a regular heading and then modifying it to enable the [`is_toggleable` property](https://developers.notion.com/reference/block#headings):

1. Add a heading with Notion node.
2. Select the resource you want to add a heading to:
* To add a new page with a heading, select the **Page** or **Database Page** resources with the **Create** operation.
* To add a heading to an existing page, select the **Block** resource with the **Append After** operation.
3. Select **Add Block** and set the **Type Name or ID** to either **Heading 1**, **Heading 2**, or **Heading 3**.
4. Add an [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/) node connected to the Notion node and select the `GET` method.
5. Set the **URL** to `https://api.notion.com/v1/blocks/<block_ID>`. For example, if your added the heading to an existing page, you could use the following URL: `https://api.notion.com/v1/blocks/{{ $json.results[0].id }}`. If you created a new page instead of appending a block, you may need to discover the block ID by querying the page contents first.
6. Select **Predefined Credential Type** and connect your existing Notion credentials.
7. Add an [Edit Fields (Set)](/integrations/builtin/core-nodes/n8n-nodes-base.set/) node after the HTTP Request node.
8. Add `heading_1.is_toggleable` as a new **Boolean** field set to `true`. Swap `heading_1` for a different heading number as necessary.
9. Add a second HTTP Request node after the Edit Fields (Set) node.
10. Set the **Method** to `PATCH` and use `https://api.notion.com/v1/blocks/{{ $json.id }}` as the **URL** value.
11. Select **Predefined Credential Type** and connect your existing Notion credentials.
12. Enable **Send Body** and set a parameter.
13. Set the parameter **Name** to `heading_1` (substitute `heading_1` for the heading level you are using).
14. Set the parameter **Value** to `{{ $json.heading_1 }}` (substitute `heading_1` for the heading level you are using).

The above sequence will create a regular heading block. It will query the newly created header, add the `is_toggleable` property, and update the heading block.

## Handle null and empty values

You may receive a validation error when working with the Notion node if you submit fields with empty or null values. This can occur any time you populate fields from previous nodes when that data is missing.

To work around this, check for the existence of the field data before sending it to Notion or use a default value.

To check for the data before executing the Notion node, use an [If](/integrations/builtin/core-nodes/n8n-nodes-base.if/) node to check whether the field is unset. This allows you to use the [Edit Fields (Set)](/integrations/builtin/core-nodes/n8n-nodes-base.set/) node to conditionally remove the field when it doesn't have a valid value.

As an alternative, you can set a [default value](/code/cookbook/expressions/check-incoming-data/) if the incoming data doesn't provide one.
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ Refer to [Notion's documentation](https://developers.notion.com/){:target=_blank

--8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md"

## Common issues

For common errors or issues and suggested resolution steps, refer to [Common issues](/integrations/builtin/app-nodes/n8n-nodes-base.notion/common-issues/).
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,9 @@ nav:
- Netscaler ADC: integrations/builtin/app-nodes/n8n-nodes-base.netscaleradc.md
- Nextcloud: integrations/builtin/app-nodes/n8n-nodes-base.nextcloud.md
- NocoDB: integrations/builtin/app-nodes/n8n-nodes-base.nocodb.md
- Notion: integrations/builtin/app-nodes/n8n-nodes-base.notion.md
- Notion:
- Notion: integrations/builtin/app-nodes/n8n-nodes-base.notion/index.md
- Common issues: integrations/builtin/app-nodes/n8n-nodes-base.notion/common-issues.md
- npm: integrations/builtin/app-nodes/n8n-nodes-base.npm.md
- Odoo: integrations/builtin/app-nodes/n8n-nodes-base.odoo.md
- Okta: integrations/builtin/app-nodes/n8n-nodes-base.okta.md
Expand Down

0 comments on commit c572977

Please sign in to comment.