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

Undefined constant RedisCluster::OPT_PREFIX #1207

Closed
lucasromanojf opened this issue Apr 11, 2024 · 5 comments
Closed

Undefined constant RedisCluster::OPT_PREFIX #1207

lucasromanojf opened this issue Apr 11, 2024 · 5 comments
Assignees

Comments

@lucasromanojf
Copy link
Contributor

Bug description

Hello,

We upgraded a project which uses tenancy (version 3.8.0) to Laravel 11, and also php to 8.3.

When deploying to Laravel Vapor, we received this error during deploy. We are using the php-8.3:al2-arm runtime.

Any ideas? We confirmed that the redis client being used is php redis and not predis.

Thanks!

Steps to reproduce

Deploy L11 project to Vapor with php-8.3:al2-arm runtime using redis as cache.

Expected behavior

Deploy should finish without errors

Laravel version

11.2

stancl/tenancy version

3.8.0

@lucasromanojf lucasromanojf added the bug Something isn't working label Apr 11, 2024
@stancl stancl removed the bug Something isn't working label Apr 11, 2024
@stancl
Copy link
Member

stancl commented Apr 11, 2024

The Redis bootstrapper expects phpredis to be installed.

We confirmed that the redis client being used is php redis and not predis.

Confirm that the php extension is installed.

Additionally notice that it's saying the property doesn't exist on RedisCluster. Might be related to your Redis setup.

@stancl stancl closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@lucasromanojf
Copy link
Contributor Author

lucasromanojf commented Apr 11, 2024

I was able to fix it by creating my own RedisTenancyBootstrapper extending package's and changing all occurrences of

$client::OPT_PREFIX

To

\Redis::OPT_PREFIX

Maybe It is not the best solution but works for me for now.

Thanks!

@stancl
Copy link
Member

stancl commented Apr 11, 2024

Interesting, in the case of clusters it's possible the actual client instance is a RedisCluster instance, but it still supports setting opts defined on the Redis class. I'll look into this 👍🏻

@lucasromanojf
Copy link
Contributor Author

lucasromanojf commented Apr 11, 2024 via email

@lucasromanojf
Copy link
Contributor Author

lucasromanojf commented Apr 11, 2024

It looks like it is related to phpredis 6. RedisCluster constants were removed and only Redis constants should be used, if I understood correctly in some searches.

Also Laravel itself has a merged PR that changes all RedisCluster constant references to Redis:

laravel/framework#48362

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