/** * Test Redis Connection and Check Session Keys */ const Redis = require('ioredis') const redis = new Redis({ host: '10.1.0.20', port: 6379, password: '!DC1qaz2wsx', db: 0, }) async function testRedis() { try { console.log('Testing Redis connection...') // Test connection const pong = await redis.ping() console.log('āœ… Redis PING:', pong) // List all nextauth keys const keys = await redis.keys('nextauth:*') console.log('\nšŸ“‹ NextAuth session keys:', keys) console.log('Total keys:', keys.length) // Show first key content if exists if (keys.length > 0) { const firstKey = keys[0] const value = await redis.get(firstKey) console.log(`\nšŸ“„ Content of ${firstKey}:`) console.log(value) const ttl = await redis.ttl(firstKey) console.log(`\nā° TTL: ${ttl} seconds`) } else { console.log('\nāš ļø No session keys found!') } } catch (error) { console.error('āŒ Redis error:', error) } finally { redis.disconnect() } } testRedis()