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

[4.x]: CP login issues when using replica database #15480

Open
WHITE-developer opened this issue Aug 6, 2024 · 0 comments
Open

[4.x]: CP login issues when using replica database #15480

WHITE-developer opened this issue Aug 6, 2024 · 0 comments

Comments

@WHITE-developer
Copy link

What happened?

Description

We configured a read replica database, but this causes login issues when there's some lag in syncing with the master db.

At these moments we are unable to login. We don't get a clear error and we are just redirected back to the login page.
In our logs we see the following warning:

web yii\web\User::renewAuthStatus [WARNING] Invalid session auth key attempted for user

Which I can resolve to this line:
https://github.com/craftcms/cms/blob/4.x/src/elements/User.php#L1049

Looks like the record isn't in the replica yet due to the lag. When we disable the replica, it all works fine.
Maybe this query should always be executed on the master db?

Craft CMS version

4.8.5

PHP version

8.2.13

Operating system and version

No response

Database type and version

MySQL 8.0.36 (AWS RDS)

Image driver and version

No response

Installed plugins and versions

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

1 participant