ruby / json

JSON implementation for Ruby
https://ruby.github.io/json
Other
704 stars 333 forks source link

undefined method `parse' for JSON::Ext::Parser:Class #694

Closed mullermp closed 2 weeks ago

mullermp commented 2 weeks ago

Something in json 2.8.0 or 2.7.6 breaks usage of AWS SDK for Ruby / JRuby 9.4 related to the json class.

undefined method `parse' for JSON::Ext::Parser:Class

This happens when doing require 'aws-sdk-dynamodb'

Example CI - https://github.com/aws/aws-sessionstore-dynamodb-ruby/actions/runs/11707818540/job/32608074498

I've confirmed pinning to 2.7.5 with JRuby solves the issue.

byroot commented 2 weeks ago

Looking.

byroot commented 2 weeks ago

I'm able to repro locally, somehow jruby is loading the jar that is bundled with JRuby instead of the one bundled in the gem:

>> $LOADED_FEATURES.grep(/json/)
=> 
["/Users/byroot/.gem/rubies/jruby-9.4.8.0/gems/json-2.8.0.1-java/lib/json/version.rb",
 "/Users/byroot/.gem/rubies/jruby-9.4.8.0/gems/json-2.8.0.1-java/lib/json/common.rb",
 "/opt/rubies/jruby-9.4.8.0/lib/ruby/stdlib/json/ext/parser.jar",
 "/opt/rubies/jruby-9.4.8.0/lib/ruby/stdlib/json/ext/generator.jar",
 "/Users/byroot/.gem/rubies/jruby-9.4.8.0/gems/json-2.8.0.1-java/lib/json/ext.rb",
 "/Users/byroot/.gem/rubies/jruby-9.4.8.0/gems/json-2.8.0.1-java/lib/json.rb"]

Digging more.

byroot commented 2 weeks ago

Fixed in 2.8.1. Thanks for the report.

headius commented 2 weeks ago

@byroot The 2.8.0 gem should probably be yanked since the JRuby version is completely broken right now. Thanks for the quick fix!