FlowiseAI/Flowise

[BUG] [cause]: ConnectTimeoutError: Connect Timeout Error (attempted addresses: 172.66.47.182:443, timeout: 10000ms)

bodzebod opened this issue · 2 comments

Describe the bug
I'm building an agentflow with a supervisor and multiple workers. When I test it, I see the following error multiple times from supervisor node:

Failed to calculate number of tokens, falling back to approximate count TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RetryOperation._fn (/usr/local/lib/node_modules/flowise/node_modules/p-retry/index.js:50:12) {
[cause]: ConnectTimeoutError: Connect Timeout Error (attempted addresses: 172.66.47.182:443, timeout: 10000ms)
at onConnectTimeout (/usr/local/lib/node_modules/flowise/node_modules/undici/lib/core/connect.js:232:24)
at Immediate._onImmediate (/usr/local/lib/node_modules/flowise/node_modules/undici/lib/core/connect.js:206:11)
at process.processImmediate (node:internal/timers:483:21)
at process.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}

However, there's no configuration related to this mysterious IP 172.66.47.182 that is not in my infrastructure. This IP is a cloudflare one, and I suspect there's a hidden telemetry somewhere. I have disabled Flowise telemetry with DISABLE_FLOWISE_TELEMETRY=true, but it remains.
I'm running flowise inside an AWS private subnet that has no access to the internet, hence this IP is blocked.

To Reproduce
Steps to reproduce the behavior:

  1. Build an agent flow with a chatbot model, a supervisor and some workers
  2. Send a question to the chat
  3. Inspect the container logs (can be tailed with: sudo docker logs -f --tail 100 flowise_1)
  4. See error

Expected behavior
This error comes after a default timeout of 10s, putting some unacceptable latency.
It's not normal to have such data leak behavior while I have disabled the telemetry with DISABLE_FLOWISE_TELEMETRY=true in the container environment variables in docker-compose.yml.

Screenshots
image
image

Setup

  • Installation: using docker-compose
  • Flowise Version 2.1.3
  • OS: Linux
  • Browser: Edge

Additional context

I found that those calls are made by langchain, and targets the URL https://tiktoken.pages.dev:

/usr/local/lib/node_modules/flowise # grep -R 'pages.dev' .
./node_modules/@langchain/anthropic/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/anthropic/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/aws/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/aws/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/cohere/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/cohere/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/community/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/community/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/google-common/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/google-common/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/google-gauth/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/google-gauth/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/groq/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/groq/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/mongodb/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/mongodb/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/pinecone/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/pinecone/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/weaviate/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/@langchain/weaviate/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/langchain/node_modules/@langchain/core/dist/utils/tiktoken.cjs:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/langchain/node_modules/@langchain/core/dist/utils/tiktoken.js:            .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)
./node_modules/psl/data/rules.json:"pages.dev",
./node_modules/psl/dist/psl.js:"pages.dev",

While those calls appear inside langchain module, this is actually inherited from tiktoken library (https://github.com/openai/tiktoken).

I found a post about configuring offline mode for tiktoken:
https://stackoverflow.com/questions/76106366/how-to-use-tiktoken-in-offline-mode-computer

Following the information given in stackoverflow, I tried to download some encoder files for gpt-4o, then uploaded them to flowise server and set TIKTOKEN_CACHE_DIR to my upload folder. But it didn't change anything.

While it's actually a tiktoken issue, it's annoying for a flowise user like me. I will try to ask the network admins for whitelisting https://tiktoken.pages.dev .

thanks for figuring out the issue! closing for now