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

PHP Fatal error: Uncaught ValueError: Invalid port in /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php:120 #33

Open
LyKos4 opened this issue Apr 24, 2024 · 1 comment

Comments

@LyKos4
Copy link

LyKos4 commented Apr 24, 2024

Below error has been generated

PHP Fatal error: Uncaught ValueError: Invalid port in /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php:120
Stack trace:
#0 /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php(120): RedisSentinel->__construct(Array)
#1 /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php(57): Namoshek\Redis\Sentinel\Connectors\PhpRedisSentinelConnector->connectToSentinel(Array)
#2 /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php(32): Namoshek\Redis\Sentinel\Connectors\PhpRedisSentinelConnector->createClient(Array)
#3 /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php(36): Namoshek\Redis\Sentinel\Connectors\PhpRedisSentinelConnector->Namoshek\Redis\Sentinel\Connectors{closure}()
#4 /application/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(112): Namoshek\Redis\Sentinel\Connectors\PhpRedisSentinelConnector->connect(Array, Array)
#5 /application/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(91): Illuminate\Redis\RedisManager->resolve('cache')
#6 /application/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(262): Illuminate\Redis\RedisManager->connection('cache')
#7 /application/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(62): Illuminate\Cache\RedisStore->connection()
#8 /application/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(99): Illuminate\Cache\RedisStore->get('sentry_rate_lim...')
#9 /application/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php(139): Illuminate\Cache\Repository->get('sentry_rate_lim...', 0)
#10 /application/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php(92): Illuminate\Cache\RateLimiter->attempts('sentry_rate_lim...')
#11 /application/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php(74): Illuminate\Cache\RateLimiter->tooManyAttempts('sentry_rate_lim...', 100)
#12 /application/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Illuminate\Cache\RateLimiter->attempt('sentry_rate_lim...', 100, Object(Closure), 60)
#13 /application/app/Exceptions/Handler.php(79): Illuminate\Support\Facades\Facade::__callStatic('attempt', Array)
#14 [internal function]: App\Exceptions\Handler->App\Exceptions{closure}(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#15 /application/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/ReportableHandler.php(45): call_user_func(Object(Closure), Object(Symfony\Component\ErrorHandler\Error\FatalError))
#16 /application/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(256): Illuminate\Foundation\Exceptions\ReportableHandler->__invoke(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#17 /application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(198): Illuminate\Foundation\Exceptions\Handler->report(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#18 /application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(246): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#19 /application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#20 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap{closure}()
#21 {main}
thrown in /application/vendor/namoshek/laravel-redis-sentinel/src/Connectors/PhpRedisSentinelConnector.php on line 120

with settings
REDIS_SENTINEL_HOST: sentinel.redis-sentinel.svc.cluster.local:26379 (tried with and without port)
REDIS_SENTINEL_PORT: "26379"

where sentinel is a service with port 26379 in namespace redis-sentinel defined in kubernetes cluster.

Any ideas why there is an issue with the port settings?

@Namoshek
Copy link
Owner

My only idea is that there is an issue with the type of the port, e.g. that it is passed as string instead of an integer. Maybe cast the value in the config?

'sentinel_port' => (int) env('REDIS_SENTINEL_PORT', 26379),

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

No branches or pull requests

2 participants