getsentry / getsentry/sentry-ruby

Deprecation warning with json gem 2.8.0+

Open
#2,462 0 comments 9 reactions 1 assignee Claimed by @sl0thentr0py View on GitHub
Good First Issue Improvement Refactoring Ruby
Dominant language
Ruby
Stars
987
Forks
541
Avg merge
17h 40m
Merged PRs (30d)
19

Description

### Issue Description

The `json`-gem has introduced deprecation warnings in 2.8.0, see https://github.com/ruby/json/pull/643. When using Sentry this leads to the following deprecation:
```
/app/vendor/bundle/ruby/3.3.0/gems/json-2.8.1/lib/json/common.rb:288: warning: JSON.generate: UTF-8 string passed as BINARY, this will raise an encoding error in json 3.0 (RubyWarningHandler::Warning)

/app/vendor/bundle/ruby/3.3.0/gems/json-2.8.1/lib/json/common.rb:288:in `generate',
/app/vendor/bundle/ruby/3.3.0/gems/json-2.8.1/lib/json/common.rb:288:in `generate',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/envelope/item.rb:37:in `to_s',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/envelope/item.rb:41:in `serialize',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/transport.rb:74:in `block in serialize_envelope',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/transport.rb:73:in `each',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/transport.rb:73:in `serialize_envelope',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/transport.rb:61:in `send_envelope',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/transport.rb:51:in `send_event',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/client.rb:208:in `send_event',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/client.rb:271:in `block in dispatch_background_event',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-rails-5.21.0/lib/sentry/rails/background_worker.rb:6:in `_perform',
/app/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.21.0/lib/sentry/background_worker.rb:56:in `block in perform',
/app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in `run_task',
/app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:in `block (3 levels) in create_worker',
:187:in `loop',
/app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in `block (2 levels) in create_worker',
/app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `catch',
/app/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `block in create_worker'
```

### Reproduction Steps

Use Sentry with json gem version 2.8.0+

### Expected Behavior

Normal use should not produce deprecation warnings.

### Actual Behavior

Deprecation warning printed

### Ruby Version

3.3.6

### SDK Version

5.21.0

### Integration and Its Version

_No response_

### Sentry Config

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.