SocketClosedUnexpectedlyError: Socket closed unexpectedly

Apr 30 08:12:30 PM at TLSSocket. (/opt/render/project/src/server/node_modules/@redis/client/dist/lib/client/socket.js:194:118)

Apr 30 08:12:30 PM at Object.onceWrapper (node:events:633:26)

Apr 30 08:12:30 PM at TLSSocket.emit (node:events:530:35)

Apr 30 08:12:30 PM at node:net:337:12

Apr 30 08:12:30 PM at TCP.done (node:_tls_wrap:657:7)

let redisClient = createClient({
  url: process.env.REDIS_URL,
  socket: {
    reconnectStrategy: retries => Math.min(retries * 50, 500),
  },
  pingInterval: 10000,
})

redisClient.on('connect', () => console.log('Conectado a Redis!'))
redisClient.on('error', err => console.error('Error al conectar a Redis:', err))
redisClient.on('end', () => console.log('Cliente de Redis desconectado'))

redisClient.connect().catch(console.error)

// Initialize store.
let redisStore = new RedisStore({
  client: redisClient,
})

const sessionMiddleware = session({
  secret: 'supersecreto',
  resave: false,
  saveUninitialized: false,

  cookie: {
    sameSite: 'lax',
    secure: process.env.NODE_ENV === 'production' ? true : false,
    domain: process.env.NODE_ENV === 'production' ? 'api.avoqado.io' : 'localhost',
    httpOnly: true,
    maxAge: 1000 * 60 * 60 * 24 * 7,
  }, // Asegúrate de que en desarrollo no esté en secure, sólo en producción
  store: redisStore,
})

app.use(sessionMiddleware)

Hi there,

Is this from an internal or external service? Are you using the internal or external URL for process.env.REDIS_URL.

Regards,

Keith
Render Support, UTC+10 :australia:

Hi Keith, im using render Redis and im connecting my render web service to connect to the redis. Im using External since i didnt accomplished to make it internally

Hi there,

Can you open a ticket directly with us from our dashboard so we can check your services?

Regards,

Keith
Render Support, UTC+10 :australia: