getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
927 stars 493 forks source link

Transaction sending failed: Net::OpenTimeout #2220

Closed 1c7 closed 8 months ago

1c7 commented 8 months ago
image image

Environment

  1. Ruby on Rails 7.1.2
  2. Ruby 3.2.2

File

config/initializers/sentry.rb

env_sentry_dsn = ENV['SENTRY_DSN']
Sentry.init do |config|
  config.dsn = env_sentry_dsn
  config.environment = ENV['APP_ENVIRONMENT'] || ENV['RAILS_ENV']
  config.breadcrumbs_logger = [:active_support_logger, :http_logger]
  config.traces_sample_rate = ENV['SENTRY_TRACES_SAMPLE_RATE'] || 1.0
  config.excluded_exceptions += %i[AliyunQuerySendDetailWorker::RetrySidekiqWorkerNotError Mime::Type::InvalidMimeType]
end

Expect

Sentry work on my local environment too.

What went wrong

not working, no error is being sent to Sentry

Suspect

Sentry being blocked by China's firewall (just like Youtube/Twitter/Instagram/etc)

Question

How can I debug this and find out why error is not being send to Sentry?

sl0thentr0py commented 8 months ago

@1c7 this is some low level network problem (firewall as you already hinted). You can try this https://gist.github.com/brainlid/2721486 so that Net::HTTP outputs more debug info.

1c7 commented 8 months ago

I can confirm it's network issue,

Thanks for providing help on how to output debug info.

Using proxy

I have a proxy running at 127.0.0.1:1087. and then I set these 2 environment variable (I am using macOS Sonoma 14.2.1)

export http_proxy=http://127.0.0.1:1087;
export https_proxy=http://127.0.0.1:1087;

and then

rails console
Sentry.capture_message("aaa", level: :fatal)

0

1

The error can be seen on Sentry. (it Works)

image

When I am not using proxy

2

3

You can see the "Net::OpenTimeout" Error

Thanks