Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry-rails 4.9.0 breaks channels specs #1685

Closed
maciejpankanin opened this issue Jan 14, 2022 · 1 comment · Fixed by #1686
Closed

sentry-rails 4.9.0 breaks channels specs #1685

maciejpankanin opened this issue Jan 14, 2022 · 1 comment · Fixed by #1686
Assignees
Projects
Milestone

Comments

@maciejpankanin
Copy link

maciejpankanin commented Jan 14, 2022

Issue Description

Recently bumped sentry SKD to 4.9.0 and after that none of my channel specs passes 🙁

I get this error:

       undefined method `env' for #<ActionCable::Channel::ConnectionStub (...)
     # /usr/local/bundle/gems/sentry-rails-4.9.0/lib/sentry/rails/action_cable.rb:72:in `sentry_capture'
     # /usr/local/bundle/gems/sentry-rails-4.9.0/lib/sentry/rails/action_cable.rb:62:in `block (2 levels) in included'
     # /usr/local/bundle/gems/actioncable-6.1.4.4/lib/action_cable/engine.rb:68:in `block (3 levels) in <class:Engine>'
     # /usr/local/bundle/gems/actioncable-6.1.4.4/lib/action_cable/channel/base.rb:180:in `subscribe_to_channel'
     # /usr/local/bundle/gems/actioncable-6.1.4.4/lib/action_cable/channel/test_case.rb:228:in `subscribe'
     # ./spec/channels/agent_call_channel_spec.rb:7:in `block (2 levels) in <top (required)>'

Spec looks like this:

it "subscribes to a stream" do
    stub_connection cable_agent: agent

    subscribe

    expect(subscription).to be_confirmed
    assert_has_stream_for agent
end

I looked into ActionCable source and found out there is no env accessor for ActionCable::Channel::ConnectionStub class.

ActionCable::Connection
ActionCable::Channel::ConnectionStub

I do not see clear solution here, but maybe SDK could extend ActionCable::Channel::ConnectionStub and add .env attribute?

Reproduction Steps

Just prepare any channel spec using stub_connection helper.

Expected Behavior

Sentry SDK is not breaking any specs.

Actual Behavior

Sentry SDK is breaking channel specs.

Ruby Version

3.0.3

SDK Version

4.9.0

Integration and Its Version

Rails 6.1.4.4

Sentry Config

No response

@st0012
Copy link
Collaborator

st0012 commented Jan 14, 2022

Thanks for reporting the issue. I'm checking it and have found some other issues that should be addressed at the same time. I'll open a PR for it today.

@st0012 st0012 added this to the 4.9.1 milestone Jan 14, 2022
@st0012 st0012 added this to To do in 4.x via automation Jan 14, 2022
@st0012 st0012 moved this from To do to Done in 4.x Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4.x
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants