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

Fix NameErrorRequire: uninitialized constant ActiveSupport::IsolatedExecutionState #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

orien
Copy link
Contributor

@orien orien commented Feb 2, 2023

Rails does not support requiring a specific internal file without first requiring 'active_support'.

This change resolves the following error:

AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:274:in `registry': uninitialized constant ActiveSupport::IsolatedExecutionState (NameError)
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:269:in `instrumenter'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:206:in `instrument'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/faraday-1.10.3/lib/faraday/request/instrumentation.rb:48:in `call'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/faraday-1.10.3/lib/faraday/rack_builder.rb:154:in `build_response'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/faraday-1.10.3/lib/faraday/connection.rb:516:in `run_request'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/faraday-1.10.3/lib/faraday/connection.rb:202:in `get'
	from AvaTax-REST-V2-Ruby-SDK/lib/avatax/request.rb:26:in `request'
	from AvaTax-REST-V2-Ruby-SDK/lib/avatax/request.rb:10:in `get'
	from AvaTax-REST-V2-Ruby-SDK/lib/avatax/client/companies.rb:428:in `query_companies'
	from AvaTax-REST-V2-Ruby-SDK/spec/spec_helper.rb:20:in `<top (required)>'
	from AvaTax-REST-V2-Ruby-SDK/spec/avatax/client/accounts_spec.rb:1:in `require'
	from AvaTax-REST-V2-Ruby-SDK/spec/avatax/client/accounts_spec.rb:1:in `<top (required)>'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
	from AvaTax-REST-V2-Ruby-SDK/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.5.4/exe/rspec:4:in `<main>'

Rails does not support requiring a specific internal file without first
requiring 'active_support'
@orien orien changed the title Require active_support Fix NameErrorRequire: uninitialized constant ActiveSupport::IsolatedExecutionState Feb 2, 2023
Copy link

@tt tt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into this same issue so would very much appreciate this change being merged.

The issue can be reproduced with Ruby 2.7 or newer. The following file is sufficient to demonstrate the failure:

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'

  gem 'avatax'
end

AvaTax::Client.new.ping

@@ -1,5 +1,6 @@
require File.expand_path('../connection', __FILE__)
require File.expand_path('../request', __FILE__)
require 'active_support'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the equivalent line in spec_helper.rb:

require 'active_support'

@tt
Copy link

tt commented Jun 25, 2024

@svc-developer, could this be merged?

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

Successfully merging this pull request may close these issues.

2 participants