Unexpected Redis behaviour

I created a free redis database.
I had a lot of problems connecting from my node app.
The provided examples didn’t work.
What worked was following the examples on the github page of the node-redis client.

Now I can read and write to my redis database from my node app (running locally)

I also connected via the redis-cli with fly redis connect

In my node app I have

const redisresult = await redisClient.set("test1", "test-value");
console.log("🚀 ~ file: server.js:18 ~ redisresult:", redisresult);

let value = await redisClient.get("test1");
console.log("🚀 ~ file: server.js:21 ~ value:", value);

I get back the value I expect.

But when I use redis-cli to get the same key as in my node app I get nil

127.0.0.1:16379> get test1
(nil)

I was expecting to get test-value not nil.

What am I doing wrong or what do I not understand?

Cheers!

I assume this is an upstash redis database.

Which example was that? This one should work: Vanilla with Candy Sprinkles · The Fly Blog

This looks like it is connecting to redis on 127.0.0.1 (i.e., localhost), not the upstash redis one specified by REDIS_URL.

It’s being tunneled through the fly cli program I installed. I don’t have a Redis instance running locally.
I was referring to the examples here: Redis by Upstash · Fly Docs

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.