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

Load Error with Timezone Gem #273

Open
Petercopter opened this issue Jul 6, 2024 · 0 comments
Open

Load Error with Timezone Gem #273

Petercopter opened this issue Jul 6, 2024 · 0 comments

Comments

@Petercopter
Copy link

Petercopter commented Jul 6, 2024

I'm having some kind of strange problem that appears to be related to the timezone gem and stupidedi.
Rails 7.1.3.4
Ruby 3.3.3

I have timezone, and its got an initializer like this:

Timezone::Lookup.config(:google) { |c| c.api_key = 'something' }

I added stupidedi to the project, and now when I rails c I get this:

/Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/rfc3986_parser.rb:130:in `split': bad URI(is not URI?): "://maps.googleapis.com" (URI::InvalidURIError)
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/rfc3986_parser.rb:135:in `parse'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/common.rb:185:in `parse'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/timezone-1.3.26/lib/timezone/lookup/basic.rb:23:in `initialize'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/timezone-1.3.26/lib/timezone/lookup/google.rb:27:in `initialize'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/timezone-1.3.26/lib/timezone/lookup.rb:67:in `new'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/timezone-1.3.26/lib/timezone/lookup.rb:67:in `make_lookup'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/timezone-1.3.26/lib/timezone/lookup.rb:36:in `config'
	from /Users/peter/work/delivery/config/initializers/timezone.rb:1:in `<main>'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/engine.rb:690:in `load'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/engine.rb:690:in `block in load_config_initializer'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/notifications.rb:208:in `instrument'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/engine.rb:689:in `load_config_initializer'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/engine.rb:643:in `block (2 levels) in <class:Engine>'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/engine.rb:642:in `each'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/engine.rb:642:in `block in <class:Engine>'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `run'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:425:in `block (2 levels) in each_strongly_connected_component_from'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:424:in `block in each_strongly_connected_component_from'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:50:in `each'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:50:in `tsort_each_child'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:418:in `call'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:418:in `each_strongly_connected_component_from'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:350:in `each'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:350:in `call'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/application.rb:426:in `initialize!'
	from /Users/peter/work/delivery/config/environment.rb:5:in `<main>'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.16/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/application.rb:402:in `require_environment!'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/command/actions.rb:20:in `boot_application!'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/commands/console/console_command.rb:105:in `perform'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/command/base.rb:178:in `invoke_command'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/command/base.rb:73:in `perform'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/command.rb:71:in `block in invoke'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/command.rb:149:in `with_argv'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/command.rb:69:in `invoke'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/railties-7.1.3.4/lib/rails/commands.rb:18:in `<main>'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/peter/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from bin/rails:4:in `<main>'

I tried doing this:

gem 'stupidedi', '~> 1.4', require: false

And that works, but I need to use the JSON parsing. If I require false, I have trouble getting the Stupidedi::Writer::Json stuff loaded correctly.

If I remove the initializer for timezone then the application loads.

I am really confused, any idea what could be causing this? Or maybe I should require false, and figure out how to get the Json class loaded correctly?

Edit: I was able to get everything I needed using require: false, so this is really just a question about why it's happening. Not sure if there's anything that can/needs to be resolved.

Edit: Wait no, it looks like I can't do required false on Stupidedi, I was just thrashing around in the console.

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