SSO login suddenly broke

AI 生成的摘要

In a thread titled “SSO login suddenly broke” within the Bug category, user Himanshu_Chhangani reported an error when attempting to log in via SSO: “Error updating information, contact site admin discourse.” The logs indicated a Job exception: undefined method 'length' for nil:NilClass. While limeblast noted a recent, self-resolving issue with GitHub, Himanshu clarified that his local setup had been working for two months before failing recently.

After codinghorror requested a stack trace, Himanshu provided detailed logs showing the error originated in lib/email.rb during email validation within the SSO process. User riking identified the root cause, suggesting the SSO parser was receiving a nil email address. uwe_keim hypothesized that a temporary GitHub outage might be a contributing factor. Following this diagnosis, Himanshu thanked the community for the help. The issue was subsequently resolved by sam, who committed an improved internal handling for this specific condition to the Discourse repository.

When I try to login into my discourse setup using SSO, i get the following error : -
Error updating information, contact site admin discourse

This is what I am getting in error logs,

Job exception: undefined method `length' for nil:NilClass

What could have possibly caused this ?
am on v1.3.0.beta6 +223

Which provider did you use?

One of my users reported issues with GitHub earlier today (which I was able to replicate) but within minutes it appears to have fixed itself.

1 个赞

@limeblast
I’ve setup discourse on my local machine, using ubuntu 14.04.

SSO integration is done with one other site.

It was working fine for 2 months, this issue has come up very recently, i got to know about it today.

Can you provide a deeper stack trace from the logs?

Here is the stack trace.

/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/treetop-1.4.15/lib/treetop/runtime/compiled_parser.rb:64:in `prepare_to_parse'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/treetop-1.4.15/lib/treetop/runtime/compiled_parser.rb:16:in `parse'
/var/www/discourse/lib/email.rb:12:in `is_valid?'
/var/www/discourse/lib/email.rb:20:in `downcase'
/var/www/discourse/app/models/user.rb:182:in `find_by_email'
/var/www/discourse/app/models/discourse_single_sign_on.rb:84:in `match_email_or_create_user'
/var/www/discourse/app/models/discourse_single_sign_on.rb:51:in `lookup_or_create_user'
/var/www/discourse/app/controllers/session_controller.rb:71:in `sso_login'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/abstract_controller/base.rb:189:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_controller/metal/rendering.rb:10:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:113:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:113:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:552:in `block (2 levels) in compile'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:502:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:502:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:86:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_controller/metal/rescue.rb:29:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/notifications.rb:159:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/notifications.rb:159:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/abstract_controller/base.rb:136:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.1.10/lib/action_view/rendering.rb:30:in `process

’
@codinghorror :- I hope this helps.

1 个赞

@codinghorror : - this should definitely help

Looks like the SSO parser is getting a nil email?

1 个赞

Today github was down for several minutes. Maybe this is a cause?

Thanx a ton @riking .

Improved internal handling for this condition.

https://github.com/discourse/discourse/commit/693b5234da304fc2a9f4e81d3f471660f55acef1

2 个赞