You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to 1.6.1 we started getting this when hen starting the Rails server: undefined method multiple?' for Grape::Validations::Types:Module`
Full stack trace
Traceback(mostrecentcalllast):
126: frombin/rails:9:in`<main>' 125: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 124: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'123: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in`register' 122: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `blockinrequire_with_bootsnap_lfi' 121: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'120: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/commands.rb:18:in`<main>' 119: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/command.rb:48:in `invoke' 118: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/command/base.rb:69:in `perform'117: from/home/sharq/.rbenv/ruby/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in`dispatch' 116: from /home/sharq/.rbenv/ruby/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command' 115: from /home/sharq/.rbenv/ruby/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'114: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/commands/server/server_command.rb:135:in`perform' 113: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/commands/server/server_command.rb:135:in `tap' 112: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/commands/server/server_command.rb:144:in `block in perform'111: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/commands/server/server_command.rb:37:in`start' 110: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout' 109: from /home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'108: from/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:249:in`app' 107: from /home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config' 106: from /home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'105: from/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in`load_file' 104: from /home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string' 103: from /home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'102: fromconfig.ru:2:in`block in <main>' 101: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `require_relative' 100: from /home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/dependencies.rb:332:in `require'99: from/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/dependencies.rb:299:in`load_dependency' 98: from /home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/dependencies.rb:332:in `blockinrequire' 97: from /home/sharq/.rbenv/ruby/2.7.0/gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:36:in `require'96: from/home/sharq/.rbenv/ruby/2.7.0/gems/skylight-5.1.1/lib/skylight/probes.rb:167:in`require' 95: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 94: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'93: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in`register' 92: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `blockinrequire_with_bootsnap_lfi' 91: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'90: from/home/sharq/projects/theapplication/config/environment.rb:6:in`<main>' 89: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application.rb:391:in `initialize!' 88: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/initializable.rb:60:in `run_initializers'87: from/home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:205:in`tsort_each' 86: from /home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each' 85: from /home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'84: from/home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:347:in`call' 83: from /home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:347:in `each' 82: from /home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'81: from/home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:431:in`each_strongly_connected_component_from' 80: from /home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:350:in `block(2levels)ineach_strongly_connected_component' 79: from /home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'78: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/initializable.rb:61:in`block in run_initializers' 77: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/initializable.rb:32:in `run' 76: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/initializable.rb:32:in `instance_exec'75: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/finisher.rb:195:in`block in <module:Finisher>' 74: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/routes_reloader.rb:10:in `execute' 73: from /home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/file_update_checker.rb:83:in `execute'72: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/routes_reloader.rb:35:in`block in updater' 71: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/routes_reloader.rb:21:in `reload!' 70: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/routes_reloader.rb:47:in `load_paths'69: from/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/routes_reloader.rb:47:in`each' 68: from /home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/application/routes_reloader.rb:47:in `blockinload_paths' 67: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'66: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in`load' 65: from /home/sharq/projects/theapplication/config/routes.rb:4:in `<main>' 64: from /home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/route_set.rb:409:in `draw'63: from/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/route_set.rb:427:in`eval_block' 62: from /home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/route_set.rb:427:in `instance_exec' 61: from /home/sharq/projects/theapplication/config/routes.rb:13:in `block in <main>'60: from/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:1030:in`constraints' 59: from /home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:901:in `scope' 58: from /home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:1030:in `block in constraints'57: from/home/sharq/projects/theapplication/config/routes.rb:14:in`block (2 levels) in <main>' 56: from /home/sharq/.rbenv/ruby/2.7.0/gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:27:in `require' 55: from /home/sharq/.rbenv/ruby/2.7.0/gems/skylight-5.1.1/lib/skylight/probes.rb:167:in `require'54: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in`require' 53: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 52: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'51: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in`block in require_with_bootsnap_lfi' 50: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 49: from /home/sharq/projects/theapplication/app/api/api/base.rb:4:in `<main>'48: from/home/sharq/projects/theapplication/app/api/api/base.rb:5:in`<module:API>' 47: from /home/sharq/projects/theapplication/app/api/api/base.rb:7:in `<class:Base>' 46: from /home/sharq/.rbenv/ruby/2.7.0/gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:27:in `require'45: from/home/sharq/.rbenv/ruby/2.7.0/gems/skylight-5.1.1/lib/skylight/probes.rb:167:in`require' 44: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 43: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'42: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in`register' 41: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `blockinrequire_with_bootsnap_lfi' 40: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'39: from/home/sharq/projects/theapplication/app/api/api/v1/base.rb:4:in`<main>' 38: from /home/sharq/projects/theapplication/app/api/api/v1/base.rb:5:in `<module:API>' 37: from /home/sharq/projects/theapplication/app/api/api/v1/base.rb:6:in `<module:V1>'36: from/home/sharq/projects/theapplication/app/api/api/v1/base.rb:19:in`<class:Base>' 35: from /home/sharq/.rbenv/ruby/2.7.0/gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:27:in `require' 34: from /home/sharq/.rbenv/ruby/2.7.0/gems/skylight-5.1.1/lib/skylight/probes.rb:167:in `require'33: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in`require' 32: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 31: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'30: from/home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in`block in require_with_bootsnap_lfi' 29: from /home/sharq/.rbenv/ruby/2.7.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 28: from /home/sharq/projects/theapplication/app/api/api/v1/activities.rb:4:in `<main>'27: from/home/sharq/projects/theapplication/app/api/api/v1/activities.rb:5:in`<module:API>' 26: from /home/sharq/projects/theapplication/app/api/api/v1/activities.rb:6:in `<module:V1>' 25: from /home/sharq/projects/theapplication/app/api/api/v1/activities.rb:32:in `<class:Activities>'24: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api.rb:55:in`block (2 levels) in override_all_methods!' 23: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api.rb:150:in `add_setup' 22: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api.rb:150:in `each'21: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api.rb:151:in`block in add_setup' 20: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api.rb:160:in `replay_step_on' 19: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/routing.rb:170:in `namespace'18: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/settings.rb:162:in`within_namespace' 17: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/routing.rb:173:in `blockinnamespace' 16: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb:107:in `nest'15: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb:107:in`each' 14: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb:107:in `blockinnest' 13: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb:125:in `evaluate_as_instance_with_configuration'12: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/util/lazy_block.rb:11:in`evaluate_from' 11: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb:118:in `blockinevaluate_as_instance_with_configuration' 10: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb:118:in `instance_eval'9: from/home/sharq/projects/theapplication/app/api/api/v1/activities.rb:35:in`block in <class:Activities>' 8: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/validations.rb:42:in `params' 7: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/validations.rb:42:in `new'6: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/params_scope.rb:39:in`initialize' 5: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/params_scope.rb:39:in `instance_eval' 4: from /home/sharq/projects/theapplication/app/api/api/v1/activities.rb:36:in `block (2 levels) in <class:Activities>'3: from/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/parameters.rb:160:in`optional' 2: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/params_scope.rb:195:in `validate_attributes' 1: from /home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/params_scope.rb:274:in `validates'/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/params_scope.rb:359:in`infer_coercion': undefined method `multiple?' forGrape::Validations::Types:Module(NoMethodError)
The theapplication/app/api/api/v1/activities.rb:36 is just the beginning of first params block that we have - the exact line is optional :expanded, type: Boolean, default: false.
We have some custom validators, but they were not the culprit, as removing them altogether did not solve the issue.
The custom validators definitions had to be updated due to change in 1.6.1
The validators were inheriting from Grape::Validations::Base and they had to be changed to inherit from Grape::Validations::Validators::Base
Adding eager_load's helped with the undefined method multiple?issue, which is a hack borrowed from another issue. So we end up having these lines at the end ofapplication.rb`:
After that server starts and some endpoints started working properly, but some started erroring out.
Turns out that there's some problem with Array type...
Changing this optional :secondaryTeamIds, type: Array[Integer] parameter into this optional :secondaryTeamIds, type: Array fixes the issue somehow. I'd rather not have to keep that change, as Array[Integer] is a valid type definition as per Grape's current readme.
The error we're getting (with Array[Integer]) is undefined method 'new' for nil:NilClass in gems/grape-1.6.1/lib/grape/validations/types/dry_type_coercer.rb:33
Full stack trace
{"data":{"timestamp":1640855071,"environment":"test","level":"error","language":"ruby","framework":"Rails: 6.1.4.4","server":{"host":"sharq","root":"/home/sharq/projects/theapplication","pid":9935},"notifier":{"name":"rollbar-gem","version":"3.3.0","configured_options":{"access_token":"******","write_to_file":true,"custom_data_method":"#<Proc:0x0000561730ced748 /home/sharq/projects/theapplication/config/initializers/rollbar.rb:26 (lambda)>","environment":"test","default_logger":"#<Proc:0x0000561735c5a5b0 /home/sharq/.rbenv/ruby/2.7.0/gems/rollbar-3.3.0/lib/rollbar/plugins/rails/railtie_mixin.rb:13>","root":"/home/sharq/projects/theapplication","framework":"Rails: 6.1.4.4","filepath":"theapplication.rollbar"}},"body":{"trace":{"frames":[{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":73,"method":"block in autorun"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":146,"method":"run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":169,"method":"__run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":169,"method":"map"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":169,"method":"block in __run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/test_unit/line_filtering.rb","lineno":10,"method":"run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":335,"method":"run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":363,"method":"with_info_handler"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":376,"method":"on_signal"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":336,"method":"block in run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":336,"method":"each"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":337,"method":"block (2 levels) in run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":350,"method":"run_one_method"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":1042,"method":"run_one_method"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-reporters-1.4.3/lib/minitest/reporters.rb","lineno":48,"method":"run_with_hooks"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest/test.rb","lineno":93,"method":"run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest/test.rb","lineno":221,"method":"with_info_handler"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":376,"method":"on_signal"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest/test.rb","lineno":94,"method":"block in run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest.rb","lineno":281,"method":"time_it"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest/test.rb","lineno":95,"method":"block (2 levels) in run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest/test.rb","lineno":195,"method":"capture_exceptions"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/minitest-5.15.0/lib/minitest/test.rb","lineno":98,"method":"block (3 levels) in run"},{"filename":"/home/sharq/projects/theapplication/test/api/api/v1/users/create_test.rb","lineno":80,"method":"block in <class:CreateTest>"},{"filename":"/home/sharq/.rbenv/versions/2.7.4/lib/ruby/2.7.0/forwardable.rb","lineno":235,"method":"post"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-test-1.1.0/lib/rack/test.rb","lineno":66,"method":"post"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-test-1.1.0/lib/rack/test.rb","lineno":129,"method":"custom_request"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-test-1.1.0/lib/rack/test.rb","lineno":266,"method":"process_request"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-test-1.1.0/lib/rack/mock_session.rb","lineno":29,"method":"request"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/engine.rb","lineno":539,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/static.rb","lineno":24,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/host_authorization.rb","lineno":113,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/sendfile.rb","lineno":110,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/static.rb","lineno":24,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/executor.rb","lineno":14,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/cache/strategy/local_cache_middleware.rb","lineno":29,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/runtime.rb","lineno":22,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/method_override.rb","lineno":24,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/request_id.rb","lineno":26,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/request_store-1.5.0/lib/request_store/middleware.rb","lineno":19,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/remote_ip.rb","lineno":81,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/rack/logger.rb","lineno":26,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/tagged_logging.rb","lineno":99,"method":"tagged"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/tagged_logging.rb","lineno":37,"method":"tagged"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/tagged_logging.rb","lineno":99,"method":"block in tagged"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/railties-6.1.4.4/lib/rails/rack/logger.rb","lineno":26,"method":"block in call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/lograge-0.11.2/lib/lograge/rails_ext/rack/logger.rb","lineno":15,"method":"call_app"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/show_exceptions.rb","lineno":33,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rollbar-3.3.0/lib/rollbar/middleware/rails/show_exceptions.rb","lineno":22,"method":"call_with_rollbar"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/debug_exceptions.rb","lineno":29,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rollbar-3.3.0/lib/rollbar/middleware/rails/rollbar.rb","lineno":22,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rollbar-3.3.0/lib/rollbar.rb","lineno":145,"method":"scoped"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rollbar-3.3.0/lib/rollbar/middleware/rails/rollbar.rb","lineno":25,"method":"block in call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/actionable_exceptions.rb","lineno":18,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/callbacks.rb","lineno":26,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb","lineno":98,"method":"run_callbacks"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/callbacks.rb","lineno":27,"method":"block in call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/cookies.rb","lineno":689,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb","lineno":260,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb","lineno":266,"method":"context"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/http/content_security_policy.rb","lineno":18,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/http/permissions_policy.rb","lineno":22,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/head.rb","lineno":12,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/conditional_get.rb","lineno":40,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/etag.rb","lineno":27,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb","lineno":15,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb","lineno":34,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb","lineno":34,"method":"catch"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb","lineno":36,"method":"block in call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/i18n-js-3.9.0/lib/i18n/js/middleware.rb","lineno":14,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-attack-6.5.0/lib/rack/attack.rb","lineno":106,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/cypress-on-rails-1.11.0/lib/cypress_on_rails/middleware.rb","lineno":20,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":169,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb","lineno":192,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/route_set.rb","lineno":842,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb","lineno":32,"method":"serve"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb","lineno":32,"method":"each"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb","lineno":50,"method":"block in serve"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb","lineno":49,"method":"serve"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb","lineno":20,"method":"block in <class:Constraints>"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api.rb","lineno":81,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb","lineno":65,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb","lineno":70,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/api/instance.rb","lineno":165,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":55,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":136,"method":"with_optimization"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":56,"method":"block in call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":72,"method":"identity"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":94,"method":"transaction"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":74,"method":"block in identity"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router.rb","lineno":120,"method":"process_route"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/router/route.rb","lineno":58,"method":"exec"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":219,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":225,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/rack-2.2.3/lib/rack/head.rb","lineno":12,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":29,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/error.rb","lineno":38,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/error.rb","lineno":38,"method":"catch"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/error.rb","lineno":39,"method":"block in call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":29,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":36,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":29,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":36,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":29,"method":"call"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/middleware/base.rb","lineno":36,"method":"call!"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":316,"method":"block in build_stack"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":241,"method":"run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/notifications.rb","lineno":205,"method":"instrument"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":259,"method":"block in run"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":351,"method":"run_validators"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":351,"method":"map"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/endpoint.rb","lineno":351,"method":"block in run_validators"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/validator_factory.rb","lineno":7,"method":"create_validator"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/validator_factory.rb","lineno":7,"method":"new"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/validators/coerce_validator.rb","lineno":13,"method":"initialize"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/types.rb","lineno":167,"method":"build_coercer"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/types.rb","lineno":201,"method":"cache_instance"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/types.rb","lineno":168,"method":"block in build_coercer"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/types.rb","lineno":192,"method":"create_coercer_instance"},{"filename":"/home/sharq/.rbenv/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/types/dry_type_coercer.rb","lineno":33,"method":"coercer_instance_for"}],"exception":{"class":"NoMethodError","message":"undefined method `new' for nil:NilClass"},"extra":{"build_id":"BUILD_ID_123"}}},"uuid":"d0e38f37-3251-43b0-ac7f-0384505786fd","request":{"url":"http://api.lvh.me:3000/v1/users","params":{},"GET":{},"POST":{"access_token":"******","email":"new_user@example.com","firstName":"Tom","lastName":"Smith","managerId":"1016184028"},"body":"{}","user_ip":"127.0.0.1","headers":{"Content-Length":"128","Host":"api.lvh.me:3000","Content-Type":"application/x-www-form-urlencoded"},"cookies":{},"session":{},"method":"POST","request_id":"fca40592-36e1-4419-944f-9b8a62a40cb1"},"person":{}}}
We're on Rails 6.1.4.4 using Ruby 2.7.4p191.
Any ideas? Thanks.
The text was updated successfully, but these errors were encountered:
After upgrading to 1.6.1 we started getting this when hen starting the Rails server:
undefined method
multiple?' for Grape::Validations::Types:Module`Full stack trace
The
theapplication/app/api/api/v1/activities.rb:36
is just the beginning of first params block that we have - the exact line isoptional :expanded, type: Boolean, default: false
.We have some custom validators, but they were not the culprit, as removing them altogether did not solve the issue.
The custom validators definitions had to be updated due to change in 1.6.1
The validators were inheriting from
Grape::Validations::Base
and they had to be changed to inherit fromGrape::Validations::Validators::Base
Adding
eager_load
's helped with theundefined method
multiple?issue, which is a hack borrowed from another issue. So we end up having these lines at the end of
application.rb`:After that server starts and some endpoints started working properly, but some started erroring out.
Turns out that there's some problem with
Array
type...Changing this
optional :secondaryTeamIds, type: Array[Integer]
parameter into thisoptional :secondaryTeamIds, type: Array
fixes the issue somehow. I'd rather not have to keep that change, asArray[Integer]
is a valid type definition as per Grape's current readme.The error we're getting (with
Array[Integer]
) isundefined method 'new' for nil:NilClass
ingems/grape-1.6.1/lib/grape/validations/types/dry_type_coercer.rb:33
Full stack trace
We're on Rails 6.1.4.4 using Ruby 2.7.4p191.
Any ideas? Thanks.
The text was updated successfully, but these errors were encountered: