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

Conflicting Base64 dependency in version 9.6.0 #2312

Closed
Talha345 opened this issue Nov 8, 2023 · 4 comments
Closed

Conflicting Base64 dependency in version 9.6.0 #2312

Talha345 opened this issue Nov 8, 2023 · 4 comments
Labels
bug community To tag external issues and PRs submitted by the community

Comments

@Talha345
Copy link

Talha345 commented Nov 8, 2023

Description

Installing the new_relic gem version 9.6.0 gives the following error:

You have already activated base64 0.1.1, but your Gemfile requires base64 0.2.0. Since base64 is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports base64 as a default gem.

Ruby Version: 3.2.2
Rails Version: 7.0.2

Happens only in Staging and Production environments.

Expected Behavior

Gem should install and there should be no runtime error.

Troubleshooting or NR Diag results

Error: The application encountered the following error: You have already activated base64 0.1.1, but your Gemfile requires base64 0.2.0. Since base64 is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports base64 as a default gem. (Gem::LoadError)
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:304:in `check_for_activated_spec!'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:25:in `block in setup'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/spec_set.rb:165:in `each'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/spec_set.rb:165:in `each'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:24:in `map'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/runtime.rb:24:in `setup'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler.rb:162:in `setup'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
    /home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/setup.rb:23:in `<top (required)>'
    <internal:/home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
    <internal:/home/deploy/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `activate_gem'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:544:in `running_bundler'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:397:in `run_block_and_record_step_progress'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

Steps to Reproduce

Install the specific Gem versions as mentioned above in the description in a Rails application and try running the application.

Your Environment

Include as many relevant details about your environment as possible including the running version of the Ruby agent, the Ruby version being used and any other relevant environment information

Happens only in Staging and Production environments.

@workato-integration
Copy link

@github-actions github-actions bot added the community To tag external issues and PRs submitted by the community label Nov 8, 2023
@Talha345
Copy link
Author

Talha345 commented Nov 8, 2023

In my case, I fixed the issue by explicitily specifying gem 'base64', '~> 0.1.1' in Gemfile.

@fallwith
Copy link
Contributor

fallwith commented Nov 8, 2023

Hi @Talha345,

We're sorry to hear that you encountered issues when bundling with the new 9.6.0 version of the agent.

The agent's newrelic_rpm.gemspec file was updated in v9.6.0 to declare a dependency on the base64 gem in preparation for the release of Ruby v3.3 on December 25th, 2023. Ruby 3.4 will not distribute the base64 gem directly and will require it to be declared in an application's Gemfile for it to be included, and Ruby 3.3 will emit warnings about this upcoming change. We did not wish to be the source of warnings for our users and we observed other gem maintainers going ahead and declaring the dependency now, so we made the decision to go ahead and declare the dependency.

We very deliberately did not impose any sort of version constraint on our base64 dependency in order to allow for maximum compatibility with applications that may already require base64 for other purposes besides sending data to New Relic.

The latest stable version (v7.1.1) of Ruby on Rails similarly declares dependencies on the gems that will not be distributed with Ruby v3.4. For example, Active Support has declared the base64 dependency without a version constraint just like we have.

Using the Ruby (v3.2.2) and Rails (v7.0.2) versions you provided, I was unable to reproduce the problem you encountered. Here are the full steps taken from scratch to create a new empty directory, create a new Rails application with New Relic agent v9.6.0, and successfully bundle the gems and run a Rails command...

mkdir base64_issue_repro
cd base64_issue_repro
bundle init
bundle add rails --version 7.0.2
bundle exec rails new demo --minimal
cd demo
bundle add newrelic_rpm
bundle exec rails runner "puts 'Hello, World!'"

The smooth experience I had with this attempt at a reproduction of a problem matches the testing our team conducted with the base64 declaration change prior to releasing the current agent version, which is to say we have not encountered any problems.

I appreciate your sharing of a fix by adding a constraint on base64 in your application's Gemfile file. The error message you shared also mentioned updating Bundler. In case doing so helps anyone else, Bundler itself can be updated via gem update --system on modern Ruby systems.

For now without a reproduction available to me, I am going to close this issue but leave it searchable for others who may encounter similar problems. We will certainly continue to monitor this particular GitHub issue and any other related correspondence and/or PRs we see against our repo or others that have began declaring dependencies in preparation for Ruby 3.3/3.4. If we get any additional feedback or reproduction steps, we'll happily investigate.

I'm very glad you were able to get things working for your own application, and thank you for the valuable data point you've given us by bringing your experience to our attention.

@fallwith fallwith closed this as completed Nov 8, 2023
@github-project-automation github-project-automation bot moved this from Triage to Code Complete/Done in Ruby Engineering Board Nov 8, 2023
@kaylareopelle
Copy link
Contributor

Hi @Talha345, we found a workaround to the base64 dependency and will remove it in an upcoming release. See #2378 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community To tag external issues and PRs submitted by the community
Projects
Archived in project
Development

No branches or pull requests

3 participants