nextjs-notion-starter-kit icon indicating copy to clipboard operation
nextjs-notion-starter-kit copied to clipboard

Timeout using Redis

Open sivannavis opened this issue 2 years ago • 6 comments

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'
}

sivannavis avatar Dec 03 '22 03:12 sivannavis

I get the same error, which is why I don't use redis.

skybird-dev avatar Dec 05 '22 21:12 skybird-dev

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 Screenshot 2023-01-08 055702

note

  1. user is not required since it's the default one
  2. the port is required since it's not the standard one

JOduMonT avatar Jan 08 '23 05:01 JOduMonT

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 Screen Shot 2023-01-11 at 9 38 50 AM

skybird-dev avatar Jan 11 '23 17:01 skybird-dev

However, I don't see why it is even necessary. Why Redis?

skybird-dev avatar Jan 18 '23 16:01 skybird-dev

@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.

transitive-bullshit avatar Jan 19 '23 09:01 transitive-bullshit

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.

sivannavis avatar Jan 19 '23 21:01 sivannavis