nextjs-notion-starter-kit
nextjs-notion-starter-kit copied to clipboard
Timeout using Redis
Hi! I'm trying to connect to my redis instance using:
REDIS_HOST='....'
REDIS_PASSWORD='...'
REDIS_USER=default
However, I can't connect to the site when I run local development, the error shows:
error - uncaughtException: Error: connect ETIMEDOUT
at Socket.<anonymous> (/Users/sivanding/my-notion-site/node_modules/ioredis/built/Redis.js:168:41)
at Object.onceWrapper (node:events:627:28)
at Socket.emit (node:events:513:28)
at Socket._onTimeout (node:net:562:8)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7) {
errorno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect'
}
I get the same error, which is why I don't use redis.
Where are your configuring your credential?
REDIS_HOST=
REDIS_PASSWORD=
these information in RedisLab are under: Subscription -> Configuration
- **REDIS_HOST is your Public endpoint: redis-2424.c200.eu-central-5-2.ec2.cloud.redislabs.com:18144
- REDIS_PASSWORD is lower under Security
For an example
in DEV put them in .env
file like this
REDIS_HOST=YourRedisLabsredisHost-234234.c400.eu-central-1-2.ec4.cloud.redislabs.com:18314
REDIS_PASSWORD=PpasswordGeneratedByRedislabs
while this is not safe; this is why it is in the .gitignore and it is not push in PROD
while in PROD with vercel
you have to put them in your PROJECT -> SETTINGS -> Environment Variables
note
- user is not required since it's the default one
- the port is required since it's not the standard one
Redis works for me. As long as they are put into Vercel as @JOduMonT described and is recommended in the readme file, and marked as "true" in siteconfig.ts
However, I don't see why it is even necessary. Why Redis?
@skybird-dev what would you recommend instead?
For larger sites, it's really prohibitive to re-compute these images on every build. Very open to other KV stores if redis isn't the best choice, though.
Thanks for the comments! @transitive-bullshit I'm wondering if this is a way to solve the image-loading issue because the images on my website usually disappear every time.