Handling Truncated URLs from database in AI Agent Workflows

Hello everyone,

I’m working with an AI Agent that retrieves long URLs from a Notion database and needs to pass them along a chain of agents. However, I’m encountering an issue where the URL gets truncated due to its length, and I can’t seem to find a way to prevent this. The end of the URL appears like this: IQoJb3JpZ2luX2VjEKr%2F… (truncated for brevity).

I’ve tried setting a strict system message instructing the agent not to truncate the URL, but this hasn’t resolved the issue. Has anyone faced a similar problem? Any solutions or workarounds that could help in preserving the full URL when passing it through the workflow? Your assistance would be greatly appreciated. Thank you!

[
	{
		"output": "{\\n "pageUrl": "<https://www.notion.so/153c7ded8dc980ffb4dacd4adf83c73f>",\\n "category": "Еда",\\n "store": "Овощной",\\n "status": "Куплено",\\n "mediaFileUrl": "<https://prod-files-secure.s3.us-west-2.amazonaws.com/c1b314be-51e1-4e01-b838-dbf3b7ef49f9/4b9346e6-c6b7-4c0f-8fe3-87996ad799b9/%D0%9F%D0%BE%D0%BC%D0%B8%D0%B4%D0%BE%D1%80%D1%8B.webp?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAZI2LB466QVRGXEZI%2F20250131%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20250131T030054Z&X-Amz-Expires=3600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEKr%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLXdlc3QtMiJIMEYCIQCwdlOJ>... (truncated for brevity)"\\n}"
	}
]

Information on your n8n setup

  • n8n version: 1.75.2
  • Database: Notion
  • n8n EXECUTIONS_PROCESS setting: main
  • Running n8n via: n8n cloud
  • Operating system: Intel Core i7

Hi @BargystVelp

Have checked in the logs that the truncated URL is not coming from Notion rather than the agent? I know that in Notion you can set an option on the URL property of a table to truncate it. Check if you need to disable that option in Notion.

Btw, you can also try the Require Specific Output Format option of the AI Agent, when you need more strictness on the output.
You can hook up another node to specify the particular output that you want the Agent to output.

Have a look in our documentation:

Hello. I’ve checked the Notion response format, and it returns a valid URL. I also added an OutputParser, but even with that, the link still gets truncated.

// Image info from Notion.
"Image": {
  "id": "HyHw",
  "type": "files",
  "files": [
    {
      "name": "Паштет.webp",
      "type": "file",
      "file": {
        "url": "https://prod-files-secure.s3.us-west-2.amazonaws.com/c1b314be-51e1-4e01-b838-dbf3b7ef49f9/12a90027-4791-457d-b78e-4a943cab6c7a/%D0%9F%D0%B0%D1%88%D1%82%D0%B5%D1%82.webp?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAZI2LB46645IQRC57%2F20250205%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20250205T184601Z&X-Amz-Expires=3600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEDIaCXVzLXdlc3QtMiJIMEYCIQDniaStShwM8NtIgiQ2Ko8XM%2BrX3YDsU%2B26B23kAXgiqQIhAI3FGK9ECDVGpj59KK0EKeVT3hiSyD1UO1uSWdCLYLpeKv8DCEoQABoMNjM3NDIzMTgzODA1Igy1%2FFLOkuRDBu1xvQsq3AM%2BAwQQSCGUuviMYxTIXRhEXAMV9ve7JmCqg41L9LrXE2gdeK9EQ0%2Fa7fUp%2BP7yTcRPcZQWykpQ1Z4pbrHIgnB9a9GY1JB6cnf7JFSQXPmus41CFwvtgZb32W09gQYxBdokGNQiwFE2Q1uFrj2x2tHq4yG4jD%2FjjjLzq3qVM9AzKKp2WHFIy4zmRrjx5nMEDVK6yiP2ZLj5KajpZUNM%2BC%2B%2BcDmFAPKEP1fJ%2BX9fVPoszW2B1NRtZ7pxO5q0m6hB2cCGJ%2FnYkBHmj6fAALCdMHqrKcIHYqxRoTjfSVddrYWP36bp39zEIEAUugKr4AQJFbcQccbKocLERln7wD08DDe3Y8OFGIUxJmu0lGRdyBsUe6YAGoZralMtoh0xvJbCR%2FelUP5myBG2QvcsFMemRjI6HC72L4O3F%2BngYwe5T2CBBl0I33BmrukCHuPA6OfDccIuK0kEVO4%2FtUKhPNIJHpggmY0kaabAWz0M3eeEYjZh7OpWMMR171Inpj%2BS%2Fjdq8Ph%2BVNwW7Fnbo9PKzE0MAEOwMrDWvAyKmE0PzZDphTd1PTY7PZgu3muP9glm4LycKqwj%2FtCOMkpdGL1YoXOCD5o4Mammy%2FXqMYTu2j6fcPNJKSCsuQsInSH%2FlmlF7zDAu469BjqkAZK3tRu8z6tkWpzjT5hyft%2F5Ach6Fs9eNuAiYmNCGhLWJ6xIqkRbGLMghH7GmZ%2FsqOm40sCSOxxHGvI1%2FjVm9CKtSBecKr0jHFWdPAd57EYeNaDl2NN2KQ1gDdH%2Bo9I3JZE%2FSb1CkJONrb6TTlG9UxANUiKln6B50TGG6BSVcCQrsg75EMX86VPwKuA7orXtSSc6jTNJ56iJXm7kdaXwhey4z%2B8W&X-Amz-Signature=a18cc7c4886ebca0ff43b0db1ddbfcbbedec54d997d98bcffd777bae31e49688&X-Amz-SignedHeaders=host&x-id=GetObject",
        "expiry_time": "2025-02-05T19:46:01.626Z"
      }
    }
  ]
}

// Output info with Output Parser