Closed jcruce13 closed 2 weeks ago
Having the same issue, can a new tag be created from latest master branch merges?
This looks like the same issue described in #98 and fixed in #100 - I just pushed those changes as v 4.1.1b1
Could you give that a try gem install ruby-jss --pre
should install it.
Also - are you making Zeitwerk "eager-load" every class by touching '/tmp/ruby-jss-zeitwerk-eager-load' ? If not, I'm not sure why it would be trying to load that file!
Thanks for the reports!
@glenfarclas17 it works on my desktop, but can you please please please 🙏 create a tag for it on https://github.com/PixarAnimationStudios/ruby-jss/tags ? for the server we use jfrog and its kind of restrictive, I cannot install it like we do in my desktop, it asks for a tag 🙏
Nope - Hold off - I just ran it with eager load and now its complaining about another class - I'll let you know when I get this figured out.
I will tag after some more testing here when its released!
Just to add a bit more of info, this is the current error I have on a server, I believe it is related:
/u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:79:in `<class:MobileDeviceInventorySearchResults>': uninitialized constant Jamf::OAPISchemas::MobileDeviceResponse (NameError)
class: Jamf::OAPISchemas::MobileDeviceResponse,
^^^^^^^^^^^^^^^^^^^^^^
Did you mean? Jamf::OAPISchemas::MobileDevicePrestage
Jamf::MobileDevicePrestage
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:64:in `<module:OAPISchemas>'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:30:in `<module:Jamf>'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:25:in `<top (required)>'
from <internal:/opt/ruby32/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/opt/ruby32/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:30:in `require'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:135:in `const_get'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:135:in `cget'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:169:in `block in actual_eager_load_dir'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:25:in `each'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/helpers.rb:25:in `ls'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:164:in `actual_eager_load_dir'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:16:in `each'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader.rb:329:in `block in eager_load_all'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader.rb:327:in `each'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/zeitwerk-2.6.8/lib/zeitwerk/loader.rb:327:in `eager_load_all'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/railties-7.0.5.1/lib/rails/application/finisher.rb:74:in `block in <module:Finisher>'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/railties-7.0.5.1/lib/rails/initializable.rb:32:in `instance_exec'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/railties-7.0.5.1/lib/rails/initializable.rb:32:in `run'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/railties-7.0.5.1/lib/rails/initializable.rb:61:in `block in run_initializers'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:347:in `each'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:347:in `call'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
from /opt/ruby32/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/railties-7.0.5.1/lib/rails/initializable.rb:60:in `run_initializers'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/railties-7.0.5.1/lib/rails/application.rb:372:in `initialize!'
from /u/apps/policies-staging/releases/20240624094538/config/environment.rb:5:in `<top (required)>'
from <internal:/opt/ruby32/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/opt/ruby32/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from config.ru:5:in `block in <main>'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/rack-2.2.6.4/lib/rack/builder.rb:125:in `instance_eval'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/rack-2.2.6.4/lib/rack/builder.rb:125:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/unicorn-6.1.0/lib/unicorn.rb:54:in `eval'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/unicorn-6.1.0/lib/unicorn.rb:54:in `block in builder'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:821:in `build_app!'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:140:in `start'
from /u/apps/policies-staging/shared/bundle/ruby/3.2.0/gems/unicorn-6.1.0/bin/unicorn:128:in `<top (required)>'
from /u/apps/policies-staging/current/bin_bundle/unicorn:27:in `load'
from /u/apps/policies-staging/current/bin_bundle/unicorn:27:in `<main>'
Yeah, That's the same issue
I'm still not sure why its eager-loading - it should only do that if youve touched a temp file, and its really only for testing, shouldn't be done on a server (and I need to remember to do it when I test!)
Ok I just pushed v4.1.1b3, which you should be able to get with the same gem install ruby-jss --pre
.... fixes another wierd problem with autoloading and class naming - and reinforces my thoughts on not using the OAPI3 schema quite so automatically.
To test please first do touch /tmp/ruby-jss-zeitwerk-eager-load
and that will make require ruby-jss
load in all the files at once. You shouldn't see any errors when you do that.
I'll run some tests here on various servers and if it looks good I'll do a release with a tag
Sorry for the inconvenience! -Chris
Version 4.1.1 has been tagged and released - hopefully with enough testing! Please let me know if you still see problems!
Cheers, -Chris
When running in Production mode I got the following error.
web-1 | Exiting web-1 | /usr/local/bundle/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:79:in'
web-1 | from /usr/local/bundle/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:30:in '
web-1 | from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in '
web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/initializable.rb:32:in '
web-1 exited with code 1
<class:MobileDeviceInventorySearchResults>': uninitialized constant Jamf::OAPISchemas::MobileDeviceResponse (NameError) web-1 | web-1 | class: Jamf::OAPISchemas::MobileDeviceResponse, web-1 | ^^^^^^^^^^^^^^^^^^^^^^ web-1 | Did you mean? Jamf::OAPISchemas::MobileDevicePrestage web-1 | Jamf::MobileDevicePrestage web-1 | from /usr/local/bundle/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:64:in
<module:Jamf>' web-1 | from /usr/local/bundle/gems/ruby-jss-4.1.0/lib/jamf/api/jamf_pro/oapi_schemas/mobile_device_inventory_search_results.rb:25:in
require' web-1 | from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in
require' web-1 | from /usr/local/bundle/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:inrequire' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/kernel.rb:26:in
require' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/cref.rb:91:inconst_get' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/cref.rb:91:in
get' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:173:inblock in actual_eager_load_dir' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/helpers.rb:47:in
block in ls' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/helpers.rb:25:ineach' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/helpers.rb:25:in
ls' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:168:inactual_eager_load_dir' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:17:in
block (2 levels) in eager_load' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:16:ineach' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:16:in
block in eager_load' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:10:insynchronize' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader/eager_load.rb:10:in
eager_load' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader.rb:413:inblock in eager_load_all' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader.rb:411:in
each' web-1 | from /usr/local/bundle/gems/zeitwerk-2.6.16/lib/zeitwerk/loader.rb:411:ineager_load_all' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/application/finisher.rb:74:in
block ininstance_exec' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/initializable.rb:32:in
run' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/initializable.rb:61:inblock in run_initializers' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:228:in
block in tsort_each' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:431:in
each_strongly_connected_component_from' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:349:inblock in each_strongly_connected_component' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:347:in
each' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:347:incall' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:347:in
each_strongly_connected_component' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:226:intsort_each' web-1 | from /usr/local/lib/ruby/3.2.0/tsort.rb:205:in
tsort_each' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/initializable.rb:60:inrun_initializers' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/application.rb:372:in
initialize!' web-1 | from /usr/src/app/config/environment.rb:5:in<main>' web-1 | from config.ru:3:in
require_relative' web-1 | from config.ru:3:inblock in <main>' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/builder.rb:116:in
eval' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/builder.rb:116:innew_from_string' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/builder.rb:105:in
load_file' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/builder.rb:66:inparse_file' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/server.rb:349:in
build_app_and_options_from_config' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/server.rb:249:inapp' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/server.rb:422:in
wrapped_app' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/server.rb:312:inblock in start' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/server.rb:379:in
handle_profiling' web-1 | from /usr/local/bundle/gems/rack-2.2.9/lib/rack/server.rb:311:instart' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:38:in
start' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:143:inblock in perform' web-1 | from <internal:kernel>:90:in
tap' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:134:inperform' web-1 | from /usr/local/bundle/gems/thor-1.3.1/lib/thor/command.rb:28:in
run' web-1 | from /usr/local/bundle/gems/thor-1.3.1/lib/thor/invocation.rb:127:ininvoke_command' web-1 | from /usr/local/bundle/gems/thor-1.3.1/lib/thor.rb:527:in
dispatch' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/command/base.rb:87:inperform' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/command.rb:48:in
invoke' web-1 | from /usr/local/bundle/gems/railties-7.0.8.4/lib/rails/commands.rb:18:in<main>' web-1 | from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in
require' web-1 | from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:inrequire' web-1 | from /usr/local/bundle/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in
require' web-1 | from /usr/src/app/bin/rails:4:in `