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

Fixed 'TypeError' in ApplicationCable::Connection#connect #19248

Conversation

yrudman
Copy link
Contributor

@yrudman yrudman commented Sep 3, 2019

ISSUE: there is error in the log :

[----] E, [2019-09-03T11:23:08.016901 #3314:2b2281efd124] ERROR -- : There was an exception - TypeError(can't cast Hash)
[----] E, [2019-09-03T11:23:08.017163 #3314:2b2281efd124] ERROR -- : /opt/rh/cfme-gemset/gems/activerecord-5.1.7/lib/active_record/connection_adapters/abstract/quoting.rb:45:in `rescue in type_cast'
...
/var/www/miq/vmdb/app/channels/application_cable/connection.rb:14:in `find_verified_user'
/var/www/miq/vmdb/app/channels/application_cable/connection.rb:6:in `connect'

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1748450

@miq_bot add-label bug

@miq-bot miq-bot added the wip label Sep 3, 2019
@yrudman yrudman force-pushed the fixed-connection-in-application-cable-when-invoking-find_by branch 2 times, most recently from 51afb1f to ff1d50b Compare September 6, 2019 11:59
@yrudman yrudman changed the title [WIP] Fix: in ApplicationCable::Connection invoke User.find_by only if userid is instance of String Fix: in ApplicationCable::Connection invoke User.find_by only if userid is instance of String Sep 6, 2019
@miq-bot miq-bot removed the wip label Sep 6, 2019
@yrudman
Copy link
Contributor Author

yrudman commented Sep 6, 2019

@miq-bot add-label ivanchuk/yes

@yrudman yrudman changed the title Fix: in ApplicationCable::Connection invoke User.find_by only if userid is instance of String Fixed 'TypeError' in ApplicationCable::Connection#connect Sep 6, 2019
@yrudman
Copy link
Contributor Author

yrudman commented Sep 6, 2019

@skateman thank you for feedback, could you review again

…o() and User.find_by(:user=>{}) would raise TypeCast error in that case.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1748450
@yrudman yrudman force-pushed the fixed-connection-in-application-cable-when-invoking-find_by branch from ff1d50b to f8889cf Compare September 6, 2019 12:32
@miq-bot
Copy link
Member

miq-bot commented Sep 6, 2019

Checked commit yrudman@f8889cf with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 1 offense detected

app/channels/application_cable/connection.rb

  • ⚠️ - Line 14, Col 23 - Lint/AssignmentInCondition - Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Seal of Approval

@lpichler
Copy link
Contributor

@miq-bot assign @gtanzillo

Copy link
Contributor

@lpichler lpichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and it works perfectly 👍

Copy link
Member

@jrafanie jrafanie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jrafanie jrafanie merged commit 040b784 into ManageIQ:master Sep 12, 2019
@jrafanie jrafanie added this to the Sprint 120 Ending Sep 16, 2019 milestone Sep 12, 2019
@yrudman yrudman deleted the fixed-connection-in-application-cable-when-invoking-find_by branch September 12, 2019 17:44
@yrudman
Copy link
Contributor Author

yrudman commented Oct 17, 2019

@miq-bot add-label changelog/no

simaishi pushed a commit that referenced this pull request Nov 1, 2019
…n-cable-when-invoking-find_by

Fixed 'TypeError'  in ApplicationCable::Connection#connect

(cherry picked from commit 040b784)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1767790
@simaishi
Copy link
Contributor

simaishi commented Nov 1, 2019

Ivanchuk backport details:

$ git log -1
commit 5834947bf7b8269a89e239413d58ea1cd8069796
Author: Joe Rafaniello <[email protected]>
Date:   Thu Sep 12 11:59:54 2019 -0400

    Merge pull request #19248 from yrudman/fixed-connection-in-application-cable-when-invoking-find_by
    
    Fixed 'TypeError'  in ApplicationCable::Connection#connect
    
    (cherry picked from commit 040b78413f9cb0d98cc1e4a81ec2eb00d283f48b)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1767790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants