postalsys / emailengine

Headless email client
https://emailengine.app/
Other
1.9k stars 168 forks source link

IPV6 fly.io not resolving when connecting Redis #439

Closed semoal closed 3 months ago

semoal commented 3 months ago

Describe the bug

 Error: getaddrinfo ENOTFOUND [2a09:8280:1::6:44ce]

2024-08-25T15:19:00.275 app[1857430a613568] mad [info] at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {

2024-08-25T15:19:00.275 app[1857430a613568] mad [info] errno: -3008,

2024-08-25T15:19:00.275 app[1857430a613568] mad [info] code: 'ENOTFOUND',

2024-08-25T15:19:00.275 app[1857430a613568] mad [info] syscall: 'getaddrinfo',

2024-08-25T15:19:00.275 app[1857430a613568] mad [info] hostname: '[2a09:8280:1::6:44ce]'

2024-08-25T15:19:00.275 app[1857430a613568] mad [info] }

To Reproduce Try to run fly.io with a redis instance and other with email engine

Expected behavior To connect succesfully

EmailEngine version v2.44.1

Environment Docker container

Redis

Additional context Add any other context about the problem here.

semoal commented 3 months ago

EENGINE_REDIS = "redis://:pwd@[2a09:8280:1::6:44ce]:6379/0" EENGINE_REDIS = "redis://:pwd@bridge-dev-redis.internal:6379/0" EENGINE_REDIS = "redis://:pwd@bridge-dev-redis.flycast:6379/0"

Tried all these combinations and none worked fine, is it probably related to the getRedisUrl() function that is not parsing it correctly?

semoal commented 3 months ago

Got it working like that:

redis://brige-dev-redis.internal:6379/0?password=pwd&family=6

The family 6 was required using redisio

andris9 commented 3 months ago

The Redis version used by Fly.io (Upstash) is not a good match for EmailEngine. The reason is that Upstash Redis counts commands, but EmailEngine runs a huge number of Redis commands. For example, with the free plan, It takes less than 10 minutes to exhaust the daily quota, even with a single email account.

semoal commented 3 months ago

No no, we're not using the Fly.io redis, we use our own instance. The problem was that Fly.io talks with ipv6 along it's machines, and i was not setting the family=6 param to the url that ioredis needs, but node redis not

andris9 commented 3 months ago

That's good to know. I haven't seen this issue before. IPv6-only stacks are not very common among EmailEngine users.