Skip to content

ActiveRecord::ReadOnlyError when using Rails read replicas #1783

@timlkelly

Description

@timlkelly

Rails raises an ActiveRecord::ReadOnlyError if the host Rails application uses Automatic Role Switching with a read-replica database when you attempt to re-authorize an application if there is an existing access token. This occurs because Doorkeeper is attempting to write to the database in a GET request, so Rails selects the read role automatically instead of the write role.

I've created a Rails project with the required configuration to showcase the error. Reproduction steps and error details are in the Readme. https://github.com/timlkelly/doorkeeper-db-replica

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions