Open giovapanasiti opened 3 years ago
I'm doing a bit of investigation on this and it seems we incorrectly assume an error in connect_to_new
is a schema missing error: https://github.com/rails-on-services/apartment/blob/1929f5f76bd654bb0023243d2ca30341761aadb1/lib/apartment/adapters/postgresql_adapter.rb#L85-L87
@giovapanasiti with the latest version, the work of @lunks has been made available. it does not fix the problem per se but it should allow you to understand what the underlying cause of the problem is. We should probably aim at better erroring in general
Steps to reproduce
I just deployed my tenant app on digitalocean app platform and digitalocean postgres db
Expected behavior
when the use hit the right subdomain it should switch to the right tenant. It usually works but sometimes sentry caught this error.
Actual behavior
randomly it raises
Apartment::TenantNotFound
One of the following schema(s) is invalid: "mainapp" "public", "shared_extensions"
System configuration
Database: (Tell us what database and its version you use.) Postgres 12
Apartment version:
ros-apartment (2.9.0)
Apartment config (in
config/initializers/apartment.rb
or so):use_schemas
:true
Rails (or ActiveRecord) version:
rails (~> 6.1.3.1)
Ruby version:
ruby 3.0.0p0