Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid Notion page IDs are rejected #10831

Closed
nihaals opened this issue Sep 16, 2024 · 10 comments
Closed

Valid Notion page IDs are rejected #10831

nihaals opened this issue Sep 16, 2024 · 10 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@nihaals
Copy link
Contributor

nihaals commented Sep 16, 2024

Bug Description

Notion documents page IDs as being UUIDv4, however I have some page IDs that don’t have a 4 in the correct position. This means some Notion nodes reject the input even though the ID came directly from a Notion API response.

n8n’s regexes that neither the ID or the URL from the API response match:

{
displayName: 'Link',
name: 'url',
type: 'string',
placeholder: 'https://www.notion.so/My-Page-b4eeb113e118403aa450af65ac25f0b9',
validation: [
{
type: 'regex',
properties: {
regex:
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?(?:[a-zA-Z0-9-]{1,}-)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}).*',
errorMessage: 'Not a valid Notion Database Page URL',
},
},
],
extractValue: {
type: 'regex',
regex:
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?(?:[a-zA-Z0-9-]{1,}-)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})',
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
placeholder: 'ab1545b247fb49fa92d6f4b49f4d8116',
validation: [
{
type: 'regex',
properties: {
regex:
'^(([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})|([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))[ \t]*',
errorMessage: 'Not a valid Notion Page ID',
},
},
],
extractValue: {
type: 'regex',
regex: '^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})',
},
url: '=https://www.notion.so/{{$value.replace(/-/g, "")}}',
},

To Reproduce

  1. Keep creating Notion pages until/find an existing page that doesn’t have a 4 in the expected position
  2. Pass it into a page action node, for example archive page as an ID
  3. Notice you get an error: “Page parameter's value is invalid. This is likely because the URL entered is incorrect [item 0]”

Expected behavior

The page is archived.

Operating System

Docker n8n:1.56.2

n8n Version

1.56.2

Node.js Version

Docker

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Sep 16, 2024

Hey @nihaals,

We have created an internal ticket to look into this which we will be tracking as "GHC-235"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Sep 16, 2024
@Joffcom
Copy link
Member

Joffcom commented Sep 16, 2024

Hey @nihaals,

Can you share some URLs that show the errors? Notion page urls should be UUID 4 looking at their documentation.

@nihaals
Copy link
Contributor Author

nihaals commented Sep 16, 2024

I think this might have changed within the past couple of weeks as the first page I just made wasn't a UUIDv4: https://www.notion.so/10336a9a827580b895e3f7ff1d3ea585.

@jshay21
Copy link

jshay21 commented Sep 20, 2024

Yes, we are having the exact same issue here

@helbertparanhos
Copy link

same issue here
2024-09-25 16_05_40-Window

@Joffcom
Copy link
Member

Joffcom commented Sep 26, 2024

@jshay21 @helbertparanhos can you both upgrade to the newest release and see if you have the same issue, @helbertparanhos your issue looks to be different as Notion is returning a different error so it is likely that you have an issue in your workflow.

@jshay21
Copy link

jshay21 commented Sep 26, 2024 via email

@nihaals
Copy link
Contributor Author

nihaals commented Sep 26, 2024

@Joffcom #10860 didn't fix this issue (see #10860 (comment)). Here's a simple workflow that reproduces the issue ("ERROR: Page parameter's value is invalid. This is likely because the URL entered is incorrect") on v1.60.1 using the ID from #10831 (comment):

Workflow JSON
{
  "nodes": [
    {
      "parameters": {},
      "id": "682aca11-cd31-4e04-a1a0-e82df830b2e2",
      "name": "Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        580,
        280
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "4f6cbbc6-562b-48a1-8d09-b0814671b5f6",
              "name": "id",
              "value": "10336a9a827580b895e3f7ff1d3ea585",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "785effe4-b5fb-40ca-af04-6b662b5c846c",
      "name": "Set ID",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        760,
        280
      ]
    },
    {
      "parameters": {
        "operation": "archive",
        "pageId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        }
      },
      "id": "baf6f8e3-69e2-4e62-a8e1-ffc7ac788319",
      "name": "Delete Notion page",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        940,
        280
      ]
    }
  ],
  "connections": {
    "Trigger": {
      "main": [
        [
          {
            "node": "Set ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set ID": {
      "main": [
        [
          {
            "node": "Delete Notion page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {}
}

@Joffcom
Copy link
Member

Joffcom commented Sep 27, 2024

@nihaals I was referring to this PR: #10938 which makes another change and is part of 1.61.0 which is the newest release.

@nihaals
Copy link
Contributor Author

nihaals commented Sep 27, 2024

Ah, I thought you meant latest stable and didn't see that PR linking to this issue.

@nihaals nihaals closed this as completed Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

4 participants