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

NameError: uninitialized constant SlackRubyBotServer::Api::Presenters::TeamPresenter::Boolean w/mongoid 7.3.x #138

Closed
dwyn opened this issue May 29, 2021 · 5 comments · Fixed by #140

Comments

@dwyn
Copy link

dwyn commented May 29, 2021

Hiya!

I am actually using slack-ruby-bot-server in another slack-bot rails app. This is the repo. When running rails s, I receive the following error:

/Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb:13:in `<module:TeamPresenter>': uninitialized constant SlackRubyBotServer::Api::Presenters::TeamPresenter::Boolean (NameError)

This is the entire stack trace.

➜ rails s
/Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb:13:in `<module:TeamPresenter>': uninitialized constant SlackRubyBotServer::Api::Presenters::TeamPresenter::Boolean (NameError)
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb:4:in `<module:Presenters>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb:3:in `<module:Api>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb:2:in `<module:SlackRubyBotServer>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters/team_presenter.rb:1:in `<main>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api/presenters.rb:7:in `<main>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server/api.rb:7:in `<main>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/slack-ruby-bot-server-1.2.0/lib/slack-ruby-bot-server.rb:13:in `<main>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bundler-2.2.18/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bundler-2.2.18/lib/bundler/runtime.rb:61:in `each'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bundler-2.2.18/lib/bundler/runtime.rb:61:in `block in require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bundler-2.2.18/lib/bundler/runtime.rb:50:in `each'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bundler-2.2.18/lib/bundler/runtime.rb:50:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bundler-2.2.18/lib/bundler.rb:174:in `require'
        from /Users/dharmon/Development/CMM/cipherbot/config/application.rb:20:in `<main>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:138:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/railties-6.1.3.2/lib/rails/commands/server/server_command.rb:135:in `perform'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/railties-6.1.3.2/lib/rails/command/base.rb:69:in `perform'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/railties-6.1.3.2/lib/rails/command.rb:50:in `invoke'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/railties-6.1.3.2/lib/rails/commands.rb:18:in `<main>'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/dharmon/.rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from bin/rails:4:in `<main>'

This is my Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.0.1'
# ruby '2.7.2'

# Load env variables
gem 'dotenv-rails', '~> 2.7', require: 'dotenv/rails-now' 
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
# gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
gem 'rails', '~> 6.1.0'#, '>= 6.0.3.3'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'

# ODM for mongodb
gem 'mongoid'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'listen', '~> 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Slack Ruby Bot Server
gem 'slack-ruby-bot-server', '~> 1.2.0 '
gem 'kaminari-mongoid'
gem 'mongoid-scroll'
gem 'slack-ruby-bot-server-events', github: 'slack-ruby/slack-ruby-bot-server-events', branch: 'master'

Any suggestions on debugging this error? Thanks in advance!

@dblock
Copy link
Collaborator

dblock commented May 31, 2021

This comes from Grape, https://github.com/ruby-grape/grape/blob/master/lib/grape/validations/validators/coerce.rb#L5, so it' probably something about order of includes. I can take a look if you haven't found a solution yet?

@dblock dblock added the bug? label May 31, 2021
@dwyn
Copy link
Author

dwyn commented Jun 1, 2021

I haven't found a solution yet. I can try tracking down which includes may be out of order. I'm open to any other suggestions you have. Thanks in advance!

@dblock dblock changed the title NameError failure NameError: uninitialized constant SlackRubyBotServer::Api::Presenters::TeamPresenter::Boolean w/mongoid 7.3.x Jun 1, 2021
@dblock dblock added confirmed bug and removed bug? labels Jun 1, 2021
@dblock
Copy link
Collaborator

dblock commented Jun 1, 2021

Broke because https://jira.mongodb.org/browse/MONGOID-4753 was implemented.

@dblock
Copy link
Collaborator

dblock commented Jun 1, 2021

Someone has already tried to fix this in #137, linking here.

@dblock
Copy link
Collaborator

dblock commented Jun 1, 2021

Fixed in #140.

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

Successfully merging a pull request may close this issue.

2 participants