Hi! I’m trying to set up an automation that will look at Notion database pages, take a file that sits in their page content and put it into an attachment field of the respective database page instead.
I am getting the error below which, to me, looks like the Notion integration was build with the assumption that the file link would be an external link, while Notion wants files that are already stored on their servers to be handled with a different parameter. Just my guess, though.
How can I solve this?
Output returned by the last node
ERROR: Bad request - please check your parameters
E;`j value at index 0 contains invalid url. A file with type `external` cannot contain a Notion hosted file url. Use type `file`.
1/12/2023, 12:00:27 PM
NodeApiError: Bad request - please check your parameters
at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1018:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Notion/v2/NotionV2.node.js:433:36)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:658:28)
- n8n version: 0.206.1
- Running n8n via n8n.cloud
That looks like Notion is saying an external file type can’t use a notion file url, Looking at their documentation they say you shouldn’t use one of their links as they are normally only valid for an hour and the URL instead should be external. I did a quick search on the error message and also found a reply from someone at notion to someone who had a similar issue.
Thanks for writing in. The issue here appears to be the file URL that you are using. Unfortunately, you cannot use the URL returned from the Notion API for this. When a URL for a file hosted on Notion is returned in the response, we send a AWS URL that is valid for 1 hour. However this URL cannot be used to create a block. File must be externally hosted in order to create file blocks in Notion. More details are available in our file object documentation.
Thanks a lot for the reply! I guess that confirms what I was suspecting from the massage.
I played around with generating an external link through GDrive and in a way this works (see below). However, I noticed this way the file will get attached as a link, so if I open it from Notion it will re-direct me to the GDrive page. I would prefer if these files were stored in Notion directly, like they would be if I added them manually from inside Notion.
Any ideas for how that could work?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.