-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
core: fix read replica routing during transactions (cherry-pick #19086 to version-2025.10) #19240
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* core: fix transactional app creation failing with read replicas When authentik is configured with pg read replicas, the application wizard fails with "Invalid pk - object does not exist" for the provider field. The issue occurs in the blueprint validation flow: 1. Provider is created on the primary database (e.g PK 159) 2. KeyOf.resolve() returns this PK for the application's provider field 3. ApplicationSerializer.is_valid() validates the provider FK 4. DRF's PrimaryKeyRelatedField queries to verify the PK exists 5. FailoverRouter routes this read to a replica 6. Replica hasn't replicated the new provider yet --> validation fails Number 6 happens because the transaction has not been commited yet cause blueprint validation runs in transaction_rollback() The fix introduces TransactionApplicationRequestSerializer which excludes provider-related fields (provider, provider_obj, backchannel_providers, backchannel_providers_obj) from validation. This is safe because: - The provider is created in the same blueprint transaction - The KeyOf reference correctly links them during blueprint apply() - The blueprint importer handles the actual FK assignment * wip * wip * wip * wip * wip * wip
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
rissson
approved these changes
Jan 8, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #19086 to
version-2025.10branch.Original PR: #19086
Original Author: @dominic-r
Cherry-picked commit: d7f9172