GoogleCloudPlatform / appengine-ruby

Optional integration library for the Ruby runtime for Google App Engine
Apache License 2.0
53 stars 21 forks source link

Can't run : bundle exec rake appengine:exec -- bundle exec rake db:migrate #13

Closed bisolaomisore closed 6 years ago

bisolaomisore commented 6 years ago

Hey,

I'm having similar troubles to the problems raised in issue #6,

Following this tutorial, I deployed a rails app on Google App Engine successfully, and I created a new Cloud Sql Postgres instance. (I did this all online by using the google cloud shell and it's text editor)

When I run the "bundle exec rake appengine:exec -- bundle exec rake db:migrate" command needed to migrate the database I get:

---------- EXECUTE COMMAND ----------
bundle exec rake db:migrate
rake aborted!
PG::Error: invalid encoding name: postgresql
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:709:in `set_client_encoding'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:709:in `configure_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:696:in `connect'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/schema_migration.rb:20:in `table_exists?'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/schema_migration.rb:24:in `create_table'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1125:in `initialize'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `new'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
/rbenv/versions/2.3.5/bin/bundle:22:in `load'
/rbenv/versions/2.3.5/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Debuggee gcp:566045598374:c7333d19324f1015 successfully registered
ERROR
ERROR: build step "gcr.io/google-appengine/exec-wrapper:latest" failed: exit status 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ERROR: (gcloud.container.builds.submit) build 4499d498-9214-47cf-b13a-71b6c05044bf completed with status "FAILURE"
rake aborted!
AppEngine::Util::Gcloud::GcloudFailed: GCloud failed with result code 1
/home/solaocodes/.gems/gems/appengine-0.4.4/lib/appengine/util/gcloud.rb:175:in `execute'
/home/solaocodes/.gems/gems/appengine-0.4.4/lib/appengine/exec.rb:300:in `start'
/home/solaocodes/.gems/gems/appengine-0.4.4/lib/appengine/tasks.rb:252:in `start_and_report_errors'
/home/solaocodes/.gems/gems/appengine-0.4.4/lib/appengine/tasks.rb:152:in `block in setup_exec_task'
/home/solaocodes/.gems/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => appengine:exec
(See full trace by running task with --trace)

Any thoughts on how I can fix this?

dazuma commented 6 years ago

The encoding in the tutorial looks wrong. Can you set encoding: unicode in your database.yml instead, and see if that works?

@frankyn Can you fix the sample? This line: https://github.com/GoogleCloudPlatform/ruby-docs-samples/blob/master/appengine/rails-cloudsql-postgres/config/database.yml#L40

frankyn commented 6 years ago

Thanks for the heads up. Will fix today.

frankyn commented 6 years ago

Fixed and republished.

bisolaomisore commented 6 years ago

That worked, thanks guys!!