Issue Description
We have recently been migrating Rails 5.2 apps from sentry-raven to sentry-ruby. We have 2 services that are being migrated, one that is on using sentry-raven 4.x (v4.8 to be exact, using Faraday). And another that we tried to upgrade to sentry-ruby v5.0.2. In the app using v4.8, we were able to use the steps in the (https://docs.sentry.io/platforms/ruby/migration/#renamedrelocated) to rename the proxy configuration option, and pass it a URL string as follows:
config.proxy #=> config.transport.proxy
# Example: config.transport.proxy = "http://myproxy.example.com:port"
However, doing the same when moving to v5.x throws an error when a proxy string is provided. This caused a production deployment issue for us because we only use a proxy in our production environment, and were not able to test for this in our development/testing environments.
Reproduction Steps
- Configure Sentry Ruby using v5+, setting the
transport.proxy option to a URL string based on the migration guide from sentry-raven.
Sentry.init do |config|
config.transport.proxy = "http://myproxy.example.com:port"
...
end
- Force triggering of an exception in a Rails controller method, such as
Sentry.capture_exception(StandardError.new('This is an exception'))
Expected Behavior
One of the following
- The Sentry Ruby HTTPTransport class should be able to handle the proxy as a URL string, and seamlessly convert the parse the URL string, OR
- Sentry documentation should be updated, including the migration guide, to indicate the configuration value for
config.transport.proxy should be a hash, and a string is NOT acceptable.
Actual Behavior
A no implicit conversion of Symbol into Integer exception is thrown when the proxy is set as a string instead of a hash. See the HTTPTransport class here. Therefore, events are not sent to Sentry.
See log
2022-04-01T15:20:58Z Sending envelope [event] 081d827b4aca47ecb25328d611027179 to Sentry
2022-04-01T15:20:58Z Event sending failed: no implicit conversion of Symbol into Integer
2022-04-01T15:20:58Z exception happened in background worker: String does not have #dig method
2022-04-01T15:20:58Z Sending envelope [transaction] 7193c21c36534fda8e4030d4e9a2dbd9 to Sentry
2022-04-01T15:20:58Z Transaction sending failed: no implicit conversion of Symbol into Integer
2022-04-01T15:20:58Z Unreported Transaction: V1::XXXXXController#create
2022-04-01T15:20:58Z exception happened in background worker: no implicit conversion of Symbol into Integer
Ruby Version
2.6.6
SDK Version
5+
Integration and Its Version
Rails/Sidekiq
Sentry Config
Sentry.init do |config|
config.transport.proxy = "http://myproxy.example.com:port"
...
end
Issue Description
We have recently been migrating Rails 5.2 apps from
sentry-raventosentry-ruby. We have 2 services that are being migrated, one that is on usingsentry-raven4.x (v4.8 to be exact, using Faraday). And another that we tried to upgrade tosentry-rubyv5.0.2. In the app using v4.8, we were able to use the steps in the (https://docs.sentry.io/platforms/ruby/migration/#renamedrelocated) to rename the proxy configuration option, and pass it a URL string as follows:However, doing the same when moving to v5.x throws an error when a proxy string is provided. This caused a production deployment issue for us because we only use a proxy in our production environment, and were not able to test for this in our development/testing environments.
Reproduction Steps
transport.proxyoption to a URL string based on the migration guide from sentry-raven.Sentry.capture_exception(StandardError.new('This is an exception'))Expected Behavior
One of the following
config.transport.proxyshould be ahash, and a string is NOT acceptable.Actual Behavior
A
no implicit conversion of Symbol into Integerexception is thrown when the proxy is set as a string instead of a hash. See the HTTPTransport class here. Therefore, events are not sent to Sentry.See log
Ruby Version
2.6.6
SDK Version
5+
Integration and Its Version
Rails/Sidekiq
Sentry Config