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

Redis ERR AUTH <password> called without any password configured for the default user. When username and password provided #261

Closed
Polokij opened this issue Oct 19, 2024 · 2 comments

Comments

@Polokij
Copy link

Polokij commented Oct 19, 2024

Reverb Version

v1.4.1

Laravel Version

11.28.1

PHP Version

8.2.24

Description

The Issue with Redis connection when username and password used and scaling is enabled
Auth Exception on Reverb server start:
websocket-server-websocket-1 | INFO Starting server on 0.0.0.0:8080 (localhost). websocket-server-websocket-1 | websocket-server-websocket-1 | Unhandled promise rejection with Clue\Redis\Protocol\Model\ErrorReply: ERR AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct? in /var/www/vendor/clue/redis-protocol/src/Parser/ResponseParser.php:101 websocket-server-websocket-1 | Stack trace: websocket-server-websocket-1 | #0 /var/www/vendor/clue/redis-protocol/src/Parser/ResponseParser.php(39): Clue\Redis\Protocol\Parser\ResponseParser->readResponse() websocket-server-websocket-1 | #1 /var/www/vendor/clue/redis-protocol/src/Parser/ResponseParser.php(31): Clue\Redis\Protocol\Parser\ResponseParser->tryParsingIncomingMessages() websocket-server-websocket-1 | #2 /var/www/vendor/clue/redis-react/src/StreamingClient.php(46): Clue\Redis\Protocol\Parser\ResponseParser->pushIncoming('-ERR AUTH <pass...') websocket-server-websocket-1 | #3 /var/www/vendor/evenement/evenement/src/EventEmitterTrait.php(143): Clue\React\Redis\StreamingClient->Clue\React\Redis\{closure}('-ERR AUTH <pass...') websocket-server-websocket-1 | #4 /var/www/vendor/react/stream/src/Util.php(71): Evenement\EventEmitter->emit('data', Array) websocket-server-websocket-1 | #5 /var/www/vendor/evenement/evenement/src/EventEmitterTrait.php(143): React\Stream\Util::React\Stream\{closure}('-ERR AUTH <pass...') websocket-server-websocket-1 | #6 /var/www/vendor/react/stream/src/DuplexResourceStream.php(209): Evenement\EventEmitter->emit('data', Array) websocket-server-websocket-1 | #7 /var/www/vendor/react/event-loop/src/StreamSelectLoop.php(246): React\Stream\DuplexResourceStream->handleData(Resource id #901) websocket-server-websocket-1 | #8 /var/www/vendor/react/event-loop/src/StreamSelectLoop.php(213): React\EventLoop\StreamSelectLoop->waitForStreamActivity(4990522) websocket-server-websocket-1 | #9 /var/www/vendor/laravel/reverb/src/Servers/Reverb/Http/Server.php(41): React\EventLoop\StreamSelectLoop->run() websocket-server-websocket-1 | #10 /var/www/vendor/laravel/reverb/src/Servers/Reverb/Console/Commands/StartServer.php(74): Laravel\Reverb\Servers\Reverb\Http\Server->start() websocket-server-websocket-1 | #11 /var/www/app/Console/Commands/WebsocketStart.php(41): Laravel\Reverb\Servers\Reverb\Console\Commands\StartServer->handle()
The issue is related to this line :
#https://github.com/laravel/reverb/blob/main/src/Servers/Reverb/Publishing/RedisPubSubProvider.php#L114

Here username passed as the query string, but clue/redis-react expect as url part
https://github.com/clue/reactphp-redis/blob/2.x/src/Factory.php#L104 #

My reverb config is:

    'servers' => [

        'reverb' => [
            'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
            'port' => env('REVERB_SERVER_PORT', 8080),
            'hostname' => env('REVERB_HOST'),
            'options' => [
                'tls' => [],
            ],
            'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
            'scaling' => [
                'enabled' => env('REVERB_SCALING_ENABLED', false),
                'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
                'server' => [
                    'host' => env('REDIS_HOST', '127.0.0.1'),
                    'port' => env('REDIS_PORT', '6379'),
                    'username' => env('REDIS_USERNAME'),
                    'password' => env('REDIS_PASSWORD'),
                    'database' => env('REDIS_DB', '1'),
                    'options' => [
                        'prefix' => env('REDIS_PREFIX', 'websocket'),
                    ],
                ],
            ],
            'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
            'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15),
        ],
    ],

Steps To Reproduce

  1. Add the Redis user with password
    ACL SETUSER websocket ON >secretPassword ~* +@all

  2. Fill REDIS_ and REVERB_ env variables

REDIS_CLIENT=phpredis
REDIS_HOST=redis
REDIS_USERNAME=websocket
REDIS_PASSWORD=secretPassword
REDIS_PORT=6379
  1. Validate config (on tinker, for example: )
> Illuminate\Support\Facades\Redis::set('test', 'testvalue');
= true

> Illuminate\Support\Facades\Redis::get('test');
= "testvalue"

  1. start reverb server
Next RuntimeException: Connection to redis://redis:6379?username=websocket&password=***&db=1 failed during AUTH command: ERR AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct? (EACCES) in /var/www/vendor/clue/redis-react/src/Factory.php:123
Stack trace:
#0 /var/www/vendor/react/promise/src/Internal/RejectedPromise.php(73): Clue\React\Redis\Factory->Clue\React\Redis\{closure}(Object(Clue\Redis\Protocol\Model\ErrorReply))
#1 /var/www/vendor/react/promise/src/Promise.php(173): React\Promise\Internal\RejectedPromise->then(Object(Closure), Object(Closure))
#2 /var/www/vendor/react/promise/src/Promise.php(221): React\Promise\Promise::React\Promise\{closure}(Object(React\Promise\Internal\RejectedPromise))

Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@Polokij
Copy link
Author

Polokij commented Oct 21, 2024

The issue is related to reactphp-redis
clue/reactphp-redis#160 - will create the pr with new version after merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants