Upstash Redis AUTH failed while reconnecting using php8.1-redis

After running the upstash redis queue for a while I begin to see connection errors. Here is an example from the command line.

I also see errors in the logs after scheduled jobs have been executed including SELECT failed while reconnecting, and read error on connection to tcp://fly-cold-frog-4960.upstash.io:6379","code":0

Looking for debugging help, or a better redis driver for Laravel.

Thanks!

webuser@dfe50d05:/$ php /var/www/html/artisan queue:monitor timezone

  Queue name ......................................................................................................................... Size / Status  
  timezone ................................................................................................................................... [] OK  

webuser@dfe50d05:/$ php /var/www/html/artisan queue:monitor default
{"message":"AUTH failed while reconnecting","context":{"exception":{"class":"RedisException","message":"AUTH failed while reconnecting","code":0,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:101"}},"level":400,"level_name":"ERROR","channel":"production","datetime":"2022-08-23T10:33:50.588341+00:00","extra":{}}

In PhpRedisConnector.php line 101:
                                  
  AUTH failed while reconnecting  
                                  

I assume it is using phpredis. Seems like the choice is generally between that and predis. I see this open issue :thinking:

If it’s that, there’s a suggestion from michael-grunder in there?

Moving from phpredis to predis has solved this issue. Install predis into a Laravel app with composer require predis/predis.

NOTE!:::

If you are going to use upstash for your cache driver as well (like I do), note that upstash doesn’t support database “1”, you must set your REDIS_CACHE_DB = "0" as the default is “1”. You will see SELECT failed: ERR Only 0th database is supported! Selected DB: 1 in your logs if this is set incorrectly.

2 Likes

thanks for the help @greg !

1 Like