Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching to Garnet Causes "ERR unknown command" Redis Error in Node.js Application #112

Closed
Rainscall opened this issue Mar 24, 2024 · 4 comments
Labels
answered Whether a question was answered or not bug Something isn't working

Comments

@Rainscall
Copy link

There is a nodejs application that uses redis without problems, but if I switch to garnet this error will appear:

node:internal/process/promises:288
             triggerUncaughtException(err, true /* fromPromise */);
             ^

[ErrorReply: ERR unknown command]

Node.js v18.19.1

This is the client configuration

const client = redis.createClient({
     url: 'redis://127.0.0.1:3278'
});

This is garnet's log

08::57::25 dbug: GarnetServer[0] [****:3278] Accepted TCP connection from 127.0.0.1:48968
08::57::25 dbug: Session[0] [****:3278] [127.0.0.1:48968] [0014B75E] Starting RespServerSession
08::57::25 dbug: Session[0] [****:3278] [127.0.0.1:48968] [0014B75E] Disposing RespServerSession
@badrishc
Copy link
Contributor

which command did you run? see the list of commands currently supported here: https://microsoft.github.io/garnet/docs/commands/api-compatibility

@Rainscall
Copy link
Author

which command did you run? see the list of commands currently supported here: https://microsoft.github.io/garnet/docs/commands/api-compatibility

It looks like I executed the unsupported command "FLUSHALL"

@TimLovellSmith
Copy link
Member

TimLovellSmith commented Mar 29, 2024

How is it completed? Seems like a good issue to leave open to the community to fix to me.
I assume FlushAll is non-controversial to support, as an easy enhancement to compatibility with existing redis apps.

Strawman unit test that still fails for me...

"StackExchange.Redis.RedisCommandException : This operation has been disabled in the command-map and cannot be used: FLUSHALL"

        [Test]
        public void SeFlushAllDatabasesTest()
        {
            using var redis = ConnectionMultiplexer.Connect(TestUtils.GetConfig(allowAdmin: true));
            IServer server = redis.GetServer($"{TestUtils.Address}:{TestUtils.Port}");

            for (int dbNum = 0; dbNum <= 1; dbNum++)
            {
                var db = redis.GetDatabase(dbNum);

                string origValue = "abcdefghij";
                db.StringSet("mykey", origValue);

                string retValue = db.StringGet("mykey");
                Assert.AreEqual(origValue, retValue);
            }

            server.FlushAllDatabases();

            for (int dbNum = 0; dbNum <= 1; dbNum++)
            {
                var db = redis.GetDatabase(dbNum);
                string retValue = db.StringGet("mykey");
                Assert.AreEqual(null, retValue);
            }
        }

@Rainscall Rainscall reopened this Mar 30, 2024
@badrishc
Copy link
Contributor

badrishc commented Apr 1, 2024

The workaround is to use FLUSHDB which is supported and identical.

@darrenge darrenge added bug Something isn't working answered Whether a question was answered or not labels Apr 3, 2024
@darrenge darrenge closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Whether a question was answered or not bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants