import { createClient } from 'redis' let client try { const url = new URL(process.env.REDIS_URL) if (!['redis:', 'rediss:'].includes(url.protocol) || !url.hostname) throw new Error('Invalid Redis URL.') client = createClient({ url: process.env.REDIS_URL, socket: { connectTimeout: 3000, socketTimeout: 3000, reconnectStrategy: false, }, }) client.on('error', () => {}) await client.connect() await client.ping() } catch { console.error( 'Redis check failed. Verify REDIS_URL, credentials and service availability before retrying setup.', ) process.exitCode = 1 } finally { if (client?.isOpen) client.destroy() }