-
Notifications
You must be signed in to change notification settings - Fork 464
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
There was an exception - Apartment::TenantNotFound(One of the following schema(s) is invalid: "" "public") #530
Comments
how're you switching? |
In the application controller, in a before_action like so:
Note, this worked before, but perhaps I don't have a public schema in postgres? This is a new machine. |
looks like 'tenant', here https://github.com/influitive/apartment/blob/development/lib/apartment/adapters/postgresql_adapter.rb#L79, is an empty string, judging from the error message. could |
@mikecmpbll Thanks for the dig on this Mike. I'll take a look at it today. I just bootstrapped the app on my laptop a while back so right now there's no account objects or anything seeded. But IIRC when I was working on this in the past I didn't require an account to be there. It just switched to the public schema. I'll post my findings hopefully today so we can close this out. 👍 |
@nynhex / @mikecmpbll were you able to figure this out ? I'm running into the same error while deploying to AWS using Elastic Beanstalk. In the browser, I receive the "We're sorry, but something went wrong." page ... but looking at the logs, I see this error: I'm stuck on this issue and any help would be appreciated ... |
I am also running into this problem - anyone figure out the issue? |
I ran into to this today after I mucked around with a few things in my environment. I could switch in the console, but not via http requests. By chance, I ran schemas = ActiveRecord::SchemaMigration.all
TourSet.all.each do |ts|
Apartment::Tenant.switch!(ts.subdir)
schemas.each do |schema|
migration = ActiveRecord::SchemaMigration.find_by_version(schema.version)
if migration.nil?
ActiveRecord::SchemaMigration.create(version: schema.version)
end
end
end I'm not proud, but it worked for me. Maybe some of y'all have similar issues. ¯_(ツ)_/¯ |
I am having the same, if not a similar issue. All migrations run against the 'public' schema without issues, so to do the seeds (using seed_fu). But, when Apartment tries to create the schemas for each of the tenants I get the following error. rake db:migrate I have tried running migrate against PGv11, PGv10, and PGv9 and I get the same error. Gem Versions: Apartment Config: Subdomain Application Config: Subdomain |
I ran into the same issue, and here's how I fixed it I simply added an Find below a link on Stackoverflow for the detailed answer |
I had the same issue and I solved it by:
After this, everything got back to normal. |
I'm working on an app for my company with Rails 5.1.5, Ruby 2.5.0, and Apartment latest gem cut 2.1
I haven't worked on this app for 6 months. And even before I upgraded to 5.1.5/2.5.0 I was on Rails 5.0.1 and Ruby 2.4.0 and received this error. just stalled the project and never got around to revisiting it.
There was an exception - Apartment::TenantNotFound(One of the following schema(s) is invalid: "" "public")
I'm using Postgres, for what it's worth.
I've dropped the database, recreated it, ran the migrations which did not error out. Yet when I start the rails server I get the following exception/stacktrace:
Database: psql (PostgreSQL) 10.1 MacOS High Sierra installed through homebrew
Apartment version: 2.1
Apartment config (in
config/initializers/apartment.rb
or so):use_schemas
:trueAny help you can provide is greatly appreciated.
The text was updated successfully, but these errors were encountered: