Skip to content

Occur Encoding::UndefinedConversionError when include escaped string in request #1303

@keisuke-koshikawa

Description

@keisuke-koshikawa

Describe the bug

I try to catch exception with Sentry.capture_exception but occured Encoding::UndefinedConversionError.
After investigating, the error occurred because it contained an escaped string such as \ xE3 in event_hash.

https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/lib/sentry/transport.rb#L58

error log

Unable to record event with remote Sentry server (Encoding::UndefinedConversionError - "\xE5" from ASCII-8BIT to UTF-8)

To Reproduce
request string include an escaped string such as \ xE3, \xE5.

Expected behavior
I`d like to avoid the error even if it contains escaped strings.

Actual behavior
occur Encoding::UndefinedConversionError - "\xE5" from ASCII-8BIT to UTF-8 if event_hash contain escaped string such as \ xE3, \xE5.

Environment

  • Ruby Version: upper 2.6
  • SDK Version: latest
  • Integration Versions (if any):
  • e.g. Rails 5.2

Raven Config

This is not necessary but could be helpful.

Raven.configure do |config|
  # the config you're using, without DSN and other sensitive data
end

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions