skip to Main Content

When I tried to deploy AdonisJS to digital ocean or Azure, I get this error

[ioredis] Unhandled error event: Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:209:20)

My Adonis app requires Redis to run. I’m using a Redis instance from Digital Ocean. Here’s my production config for Redis.

  prod: {
    host: Env.get("REDIS_HOST"),
    port: Env.get("REDIS_PORT"),
    password: Env.get("REDIS_PASSWORD"),
    db: 0,
    keyPrefix: ""
  },

2

Answers


  1. Chosen as BEST ANSWER

    If you are connecting your AdonisJS app to a Transport Layer Security (TLS) protected Redis instance, you need to add the tls host to your config.

    So, your prod config should look like this

      prod: {
        host: Env.get("REDIS_HOST"),
        port: Env.get("REDIS_PORT"),
        password: Env.get("REDIS_PASSWORD"),
        db: 0,
        keyPrefix: "",
        tls: {
          host: Env.get("REDIS_HOST"),
        },
      },
    

  2. As a followup to my comment – my docker environment degraded to the point where I couldn’t even connect via redis-cli to the vanilla dockerhub Redis image. I wound up cleaning out my docker environment by removing all containers, images, volumes, networks, etc., and then rebooting my mac. After rebuilding them this problem went away for me.

    I hate not knowing the "root cause" but have a theory. I had been playing with a few different Redis images including the vanilla standalone image from dockerhub and a cluster image from https://github.com/Grokzen/docker-redis-cluster. I was tweaking the build of the latter to add authentication. The theory is that there were residual processes fighting over the port from repeated builds and tear downs. I may have been impatient and hard-stopped the containers I was working on multiple times while debugging the dockerfile and docker-entrypoint.sh files. 🙂

    I know this answer isn’t directly related to hosting on DO or Azure but since the symptom is the same, perhaps there is a networking conflict somewhere.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search