Skip to content
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

undefined method `tokens' for <class instance> #1565

Open
chhlga opened this issue Nov 2, 2022 · 0 comments
Open

undefined method `tokens' for <class instance> #1565

chhlga opened this issue Nov 2, 2022 · 0 comments

Comments

@chhlga
Copy link

chhlga commented Nov 2, 2022

  • Version: 1.2.0
  • Rails Stacktrace:
/bundle/vendor/ruby/3.0.0/gems/activemodel-6.1.7/lib/active_model/attribute_methods.rb:469:in `method_missing'
/bundle/vendor/ruby/3.0.0/gems/devise_token_auth-1.2.1/app/controllers/devise_token_auth/concerns/set_user_by_token.rb:112:in `update_auth_header'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:427:in `block in make_lambda'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:246:in `block in halting'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:516:in `block in invoke_after'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:516:in `each'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:516:in `invoke_after'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:107:in `run_callbacks'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/abstract_controller/callbacks.rb:41:in `process_action'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_controller/metal/rescue.rb:22:in `process_action'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb:203:in `block in instrument'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb:203:in `instrument'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
/bundle/vendor/ruby/3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/abstract_controller/base.rb:165:in `process'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_controller/metal.rb:190:in `dispatch'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_controller/metal.rb:254:in `dispatch'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/route_set.rb:33:in `serve'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb:50:in `block in serve'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb:32:in `each'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb:32:in `serve'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/route_set.rb:842:in `call'
/bundle/vendor/ruby/3.0.0/gems/warden-1.2.9/lib/warden/manager.rb:36:in `block in call'
/bundle/vendor/ruby/3.0.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `catch'
/bundle/vendor/ruby/3.0.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-2.2.4/lib/rack/conditional_get.rb:40:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb:98:in `run_callbacks'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/bundle/vendor/ruby/3.0.0/gems/railties-6.1.7/lib/rails/rack/logger.rb:37:in `call_app'
/bundle/vendor/ruby/3.0.0/gems/railties-6.1.7/lib/rails/rack/logger.rb:26:in `block in call'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/tagged_logging.rb:37:in `tagged'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/tagged_logging.rb:99:in `tagged'
/bundle/vendor/ruby/3.0.0/gems/railties-6.1.7/lib/rails/rack/logger.rb:26:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/request_id.rb:26:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
/bundle/vendor/ruby/3.0.0/gems/activesupport-6.1.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/static.rb:24:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
/app/lib/open_api_rack/middleware.rb:11:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
/bundle/vendor/ruby/3.0.0/gems/railties-6.1.7/lib/rails/engine.rb:539:in `call'
/bundle/vendor/ruby/3.0.0/gems/rack-test-2.0.2/lib/rack/test.rb:358:in `process_request'
/bundle/vendor/ruby/3.0.0/gems/rack-test-2.0.2/lib/rack/test.rb:155:in `request'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/testing/integration.rb:279:in `process'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/testing/integration.rb:22:in `post'
/bundle/vendor/ruby/3.0.0/gems/actionpack-6.1.7/lib/action_dispatch/testing/integration.rb:372:in `post'
/app/spec/support/auth_helper.rb:9:in `block (2 levels) in <module:AuthHelper>'
/app/spec/requests/api/v1/accounts_spec.rb:13:in `block (4 levels) in <top (required)>'
/app/spec/requests/api/v1/accounts_spec.rb:16:in `block (3 levels) in <top (required)>'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:365:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:529:in `block in run_owned_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:528:in `each'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:528:in `run_owned_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:615:in `block in run_example_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:614:in `reverse_each'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:614:in `run_example_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:484:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:505:in `run_before_example'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:261:in `block in run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:486:in `block in run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
/bundle/vendor/ruby/3.0.0/gems/rspec-rails-6.0.1/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:390:in `execute_with'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:486:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:259:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:646:in `block in run_examples'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:642:in `map'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:642:in `run_examples'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:607:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `block in run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `map'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `map'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/configuration.rb:2068:in `with_suite_hooks'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:116:in `block in run_specs'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/reporter.rb:74:in `report'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:115:in `run_specs'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:89:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/invocations.rb:23:in `call'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:69:in `run'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:45:in `invoke'
/bundle/vendor/ruby/3.0.0/gems/rspec-core-3.11.0/exe/rspec:4:in `<top (required)>'
/bundle/vendor/ruby/3.0.0/bin/rspec:25:in `load'
/bundle/vendor/ruby/3.0.0/bin/rspec:25:in `<top (required)>'
/usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/3.0.0/bundler/cli.rb:479:in `exec'
/usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/3.0.0/bundler/cli.rb:31:in `dispatch'
/usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/3.0.0/bundler/cli.rb:25:in `start'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/libexec/bundle:49:in `block in <top (required)>'
/usr/local/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/libexec/bundle:37:in `<top (required)>'

I found that if I define @resource variable like

      def resource
        @resource = Account.find(params[:id])
      end

this variable fall into app/controllers/devise_token_auth/concerns/set_user_by_token.rb:112 which is raise no method error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant