Skip to content

Undefined local variable or method logger #1110

@StefanoMartin

Description

@StefanoMartin

Describe the bug
Error hit because a method is undefined

To Reproduce
I send multiple requests that prompt an error for Sentry to be caught.
This error is not prompt at any requests. Sometimes the error is sent to Sentry correctly.

Expected behavior
Do not return a undefined local error

Actual behavior

I, [2020-11-23T10:10:48.668163 #50]  INFO -- sentry: ** [Raven] Sending event ca149697840e41f39e3a42d439312d70 to Sentry
W, [2020-11-23T10:10:48.678423 #50]  WARN -- sentry: ** [Raven] Unable to record event with remote Sentry server (NameError - undefined local variable or method `logger' for #<Raven::Transports::HTTP:0x00007f666df800e0>):
/usr/local/bundle/gems/sentry-raven-3.1.1/lib/raven/transports/http.rb:16:in `send_event'
/usr/local/bundle/gems/sentry-raven-3.1.1/lib/raven/client.rb:47:in `send_event'
/usr/local/bundle/gems/sentry-raven-3.1.1/lib/raven/instance.rb:83:in `send_event'
/usr/src/app/core/setup/sentry/sentry_job.rb:13:in `block in async'
/usr/local/bundle/gems/rack-fiber_pool-0.9.3/lib/fiber_pool.rb:48:in `block (3 levels) in initialize'
/usr/local/bundle/gems/rack-fiber_pool-0.9.3/lib/fiber_pool.rb:47:in `loop'
/usr/local/bundle/gems/rack-fiber_pool-0.9.3/lib/fiber_pool.rb:47:in `block (2 levels) in initialize'
W, [2020-11-23T10:10:48.678484 #50]  WARN -- sentry: ** [Raven] Failed to submit event: <no message value>

Environment

  • Ruby Version: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
  • SDK Version: 3.1.1
  • Integration Versions (if any): no

Raven Config

This is not necessary but could be helpful.

Raven.configure do |config|
      config.processors -= [Raven::Processor::PostData]
      config.processors << Core_Setup::Remove_Not_Needed_Attributes
      config.dsn = "a_valid_dsn"
      config.sample_rate = 0.5
      config.tags = {
        service: "network",
        version: "1.0.0",
        core_version: "3.4.5"
      }
      config.current_environment = "test"
      config.async = lambda do |event|
        fiber_id = Fiber.current.object_id
        event["tags"].merge!($identifier[fiber_id]) unless $identifier.dig(fiber_id).nil?
        SentryJob.instance.async(event, instance)
      end
      config.transport_failure_callback = lambda do |event|
        SentryJob.instance.send_alert_to_admin(event)
      end
    end
 end

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions