Skip to content

[Bug]: Firecrawl self-hosted returns non-absolute URLs, causing "Invalid URL" errors in agents repo #20

@Bergdis

Description

@Bergdis

What happened?
When self-hosting Firecrawl and integrating with the agents repo, the API sometimes returns non-absolute URLs (e.g., /frontpage/). This causes downstream errors in LibreChat/agents, such as:

Error parsing URL: TypeError: Invalid URL
at new URL (node:internal/url:825:25)
...
code: 'ERR_INVALID_URL',
input: '/frontpage/'

Version Information
danny-avila/LibreChat@7742b18

Steps to Reproduce
Deploy Firecrawl self-hosted (Azure Container Apps, Docker Compose, etc.).
Use the agents repo to process crawl results.
Observe errors when the API returns relative URLs.
What browsers are you seeing the problem on?
Microsoft Edge

Relevant log output
at formatSource (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:36:10)
at Object.formatResultsForLLM (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:108:30)
at tools.tool.name (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/tool.cjs:199:47)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async DynamicStructuredTool.call (/workspaces/AdvancedChat/node_modules/@langchain/core/dist/tools/index.cjs:156:22)
at async /workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/ToolNode.cjs:58:32 {
code: 'ERR_INVALID_URL',
input: '/'
}
Error parsing URL: TypeError: Invalid URL
at new URL (node:internal/url:825:25)
at Object.getDomainName (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/utils.cjs:28:24)
at /workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:60:40
at Array.forEach ()
at formatSource (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:36:10)
at Object.formatResultsForLLM (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:108:30)
at tools.tool.name (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/tool.cjs:199:47)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async DynamicStructuredTool.call (/workspaces/AdvancedChat/node_modules/@langchain/core/dist/tools/index.cjs:156:22)
at async /workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/ToolNode.cjs:58:32 {
code: 'ERR_INVALID_URL',
input: '#'
}
Error parsing URL: TypeError: Invalid URL
at new URL (node:internal/url:825:25)
at Object.getDomainName (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/utils.cjs:28:24)
at /workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:60:40
at Array.forEach ()
at formatSource (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:36:10)
at Object.formatResultsForLLM (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/format.cjs:108:30)
at tools.tool.name (/workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/search/tool.cjs:199:47)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async DynamicStructuredTool.call (/workspaces/AdvancedChat/node_modules/@langchain/core/dist/tools/index.cjs:156:22)
at async /workspaces/AdvancedChat/node_modules/@librechat/agents/dist/cjs/tools/ToolNode.cjs:58:32 {
code: 'ERR_INVALID_URL',
input: '#'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions