-
Notifications
You must be signed in to change notification settings - Fork 1.1k
'no implicit conversion of Hash into String (TypeError)' on Travis CI #365
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
Comments
I succeeded in replicating this issue on my development machine, too now: When I run I really don't know where this comes from but as a workaround I have simply changed my script:
- bundle exec rake db:schema:load db:seed
- bundle exec rspec With this workaround my tests pass – but I wonder why |
I currently have a similar issue when running In this case, it fails due to:
I noticed that I have an earlier model identified by devise_token_auth with a column t.text for tokens which works fine, while the new migration for another model created a json column which fails in this scenario. The decision for the column type is in
Though json as column type feels cleaner to me, I am working with text for now as this seems to work. |
👍 replicated when running |
I had this same problem using RubyMine, killing spring and restarting RubyMine did the trick. Would never have figured it out without this post. Thanks! |
+1 to @adamhunter |
I have this issue too with gem spring
|
With the I haven't confirmed that this will work for authentication, but given all of the column type checking (ie; https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/models/devise_token_auth/concerns/user.rb#L26-L28) I am lead to believe it might. |
See lynndylanhurley/devise_token_auth#365 Error when creating any `User` was: "no implicit conversion of Hash into String (TypeError)"
See lynndylanhurley/devise_token_auth#365 Error when creating any `User` was: "no implicit conversion of Hash into String (TypeError)"
+1 to @itsthatguy, confirm that this change works for auth, at least with Postgres - some DBs will be better with :text for that like @anthonynavarre did above |
``` [2017-02-09T10:59:57.03022376Z] Started POST "/auth" for 100.100.80.1 at 2017-02-09 10:59:57 +0000 [2017-02-09T10:59:57.037431057Z] Processing by DeviseTokenAuth::RegistrationsController#create as */* [2017-02-09T10:59:57.037776338Z] Parameters: {"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "registration"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}} [2017-02-09T10:59:57.038541119Z] Can't verify CSRF token authenticity [2017-02-09T10:59:57.127561401Z] Completed 500 Internal Server Error in 89ms (ActiveRecord: 0.0ms) [2017-02-09T10:59:57.132036042Z] TypeError (no implicit conversion of Hash into String): [2017-02-09T10:59:57.132160824Z] vendor/bundle/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:155:in `initialize' [2017-02-09T10:59:57.132174956Z] vendor/bundle/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:155:in `new' [2017-02-09T10:59:57.132225829Z] vendor/bundle/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:155:in `parse' [2017-02-09T10:59:57.13223737Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/json/decoding.rb:26:in `decode' [2017-02-09T10:59:57.132276756Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/coders/json.rb:9:in `load' [2017-02-09T10:59:57.132326638Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/type/serialized.rb:19:in `type_cast_from_database' [2017-02-09T10:59:57.132392956Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/type/mutable.rb:5:in `type_cast_from_user' [2017-02-09T10:59:57.132405442Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute.rb:110:in `type_cast' [2017-02-09T10:59:57.132471765Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute.rb:42:in `original_value' [2017-02-09T10:59:57.132483564Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute.rb:37:in `value' [2017-02-09T10:59:57.132529495Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute.rb:50:in `changed_from?' [2017-02-09T10:59:57.13256164Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute_methods/dirty.rb:142:in `_field_changed?' [2017-02-09T10:59:57.132597155Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute_methods/dirty.rb:115:in `save_changed_attribute' [2017-02-09T10:59:57.132634495Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute_methods/dirty.rb:98:in `write_attribute' [2017-02-09T10:59:57.132684828Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attribute_methods.rb:50:in `__temp__47f6b656e637' [2017-02-09T10:59:57.132694614Z] vendor/bundle/ruby/2.2.0/gems/devise_token_auth-0.1.40/app/models/devise_token_auth/concerns/user.rb:237:in `set_empty_token_hash' [2017-02-09T10:59:57.132757703Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:430:in `block in make_lambda' [2017-02-09T10:59:57.132771262Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:226:in `call' [2017-02-09T10:59:57.132829675Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:226:in `block in halting_and_conditional' [2017-02-09T10:59:57.132849984Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:504:in `call' [2017-02-09T10:59:57.132912426Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:504:in `block in call' [2017-02-09T10:59:57.132932637Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:504:in `each' [2017-02-09T10:59:57.132974882Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:504:in `call' [2017-02-09T10:59:57.132982071Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks' [2017-02-09T10:59:57.132997291Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/core.rb:284:in `initialize' [2017-02-09T10:59:57.133007696Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/inheritance.rb:61:in `new' [2017-02-09T10:59:57.133047617Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/inheritance.rb:61:in `new' [2017-02-09T10:59:57.133055409Z] vendor/bundle/ruby/2.2.0/gems/devise_token_auth-0.1.40/app/controllers/devise_token_auth/registrations_controller.rb:9:in `create' [2017-02-09T10:59:57.133076378Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action' [2017-02-09T10:59:57.133083133Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:198:in `process_action' [2017-02-09T10:59:57.133112576Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action' [2017-02-09T10:59:57.133120236Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:20:in `block in process_action' [2017-02-09T10:59:57.133141796Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call' [2017-02-09T10:59:57.133148416Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call' [2017-02-09T10:59:57.133163156Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile' [2017-02-09T10:59:57.133185366Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call' [2017-02-09T10:59:57.133225249Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call' [2017-02-09T10:59:57.133232608Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks' [2017-02-09T10:59:57.136650724Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:19:in `process_action' [2017-02-09T10:59:57.136731718Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action' [2017-02-09T10:59:57.136837692Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' [2017-02-09T10:59:57.136858301Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument' [2017-02-09T10:59:57.137012302Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument' [2017-02-09T10:59:57.137031753Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument' [2017-02-09T10:59:57.137129222Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action' [2017-02-09T10:59:57.137158817Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' [2017-02-09T10:59:57.137198322Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action' [2017-02-09T10:59:57.137206541Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:137:in `process' [2017-02-09T10:59:57.137268109Z] vendor/bundle/ruby/2.2.0/gems/actionview-4.2.3/lib/action_view/rendering.rb:30:in `process' [2017-02-09T10:59:57.13728605Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal.rb:196:in `dispatch' [2017-02-09T10:59:57.137376928Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' [2017-02-09T10:59:57.137427551Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal.rb:237:in `block in action' [2017-02-09T10:59:57.137504923Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `call' [2017-02-09T10:59:57.137515312Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `dispatch' [2017-02-09T10:59:57.137580344Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:45:in `serve' [2017-02-09T10:59:57.137619622Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/mapper.rb:49:in `serve' [2017-02-09T10:59:57.137721551Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:43:in `block in serve' [2017-02-09T10:59:57.137741594Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `each' [2017-02-09T10:59:57.137890084Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `serve' [2017-02-09T10:59:57.137911093Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:821:in `call' [2017-02-09T10:59:57.137989539Z] vendor/bundle/ruby/2.2.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call' [2017-02-09T10:59:57.138002253Z] vendor/bundle/ruby/2.2.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch' [2017-02-09T10:59:57.138027583Z] vendor/bundle/ruby/2.2.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call' [2017-02-09T10:59:57.138048949Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/etag.rb:24:in `call' [2017-02-09T10:59:57.138076987Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/conditionalget.rb:38:in `call' [2017-02-09T10:59:57.138084051Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/head.rb:13:in `call' [2017-02-09T10:59:57.138106499Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/params_parser.rb:27:in `call' [2017-02-09T10:59:57.138113058Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/flash.rb:260:in `call' [2017-02-09T10:59:57.138150114Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:225:in `context' [2017-02-09T10:59:57.138156934Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:220:in `call' [2017-02-09T10:59:57.138190274Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/cookies.rb:560:in `call' [2017-02-09T10:59:57.138209343Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/query_cache.rb:36:in `call' [2017-02-09T10:59:57.138240024Z] vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' [2017-02-09T10:59:57.138248195Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' [2017-02-09T10:59:57.13826353Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks' [2017-02-09T10:59:57.138292424Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call' [2017-02-09T10:59:57.138320076Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/remote_ip.rb:78:in `call' [2017-02-09T10:59:57.140559611Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' [2017-02-09T10:59:57.140591861Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' [2017-02-09T10:59:57.140682501Z] vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app' [2017-02-09T10:59:57.140701227Z] vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call' [2017-02-09T10:59:57.140779795Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged' [2017-02-09T10:59:57.140790804Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged' [2017-02-09T10:59:57.140837246Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged' [2017-02-09T10:59:57.140846596Z] vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call' [2017-02-09T10:59:57.140898419Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call' [2017-02-09T10:59:57.140909281Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call' [2017-02-09T10:59:57.14097782Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in `call' [2017-02-09T10:59:57.140989504Z] vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' [2017-02-09T10:59:57.141024291Z] vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call' [2017-02-09T10:59:57.141045816Z] vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in `call' [2017-02-09T10:59:57.141089372Z] vendor/bundle/ruby/2.2.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:80:in `call' [2017-02-09T10:59:57.141102564Z] vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call' [2017-02-09T10:59:57.141164301Z] vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:165:in `call' [2017-02-09T10:59:57.141211069Z] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/configuration.rb:226:in `call' [2017-02-09T10:59:57.141254096Z] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:578:in `handle_request' [2017-02-09T10:59:57.141263723Z] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:415:in `process_client' [2017-02-09T10:59:57.141340909Z] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:275:in `block in run' [2017-02-09T10:59:57.141364262Z] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in `call' [2017-02-09T10:59:57.141413213Z] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread' ``` by applying this hack: lynndylanhurley/devise_token_auth#365 (comment)
Ran into this problem on the Trusty (beta) using Postgres 9.5 |
Seems like this problem has an accepted solution, so closing for now. |
I'm currently working on an open source project where I use this gem alongside Devise. In my
User
class I included the following:I'm also using FactoryGirl in order to lint all my factories and added some specs to my project. When I run
rspec
on my development machine (tested with Ruby 2.1.7 and Ruby 2.2.2) then all specs pass successfully. But when I push my changes and things are run on Travis CI then I get the following error message:First I thought there's something wrong with my models. But after a few hours of trial-and-error style debugging I managed to locate the part that's causing this error: It's the above quoted code where I include the Devise and DeviseTokenAuth stuff into my
User
model.I assume so because this commit fails on Travis CI (as you can see here) but the project was passing right before that commit (which you can see here).
Therefore my best guess is that something in this gem (or maybe even Devise directly?) is causing things to break on Travis CI. As it feels like a bug to me I'm posting this here instead of StackOverflow.
Feel free to checkout the 'fix-travis-ci-tests' branch in order to investigate further if needed.
I'm using v0.1.34 of devise_token_auth in a Rails 4.2.4 project.
The text was updated successfully, but these errors were encountered: