USER AFFECTED not working
florian.w
Posted on
Nov 10 2014
hi,
if a error appears, where should i see the name('loginname') of the current_user?
This is my raygun.rb:
Raygun.setup do |config|
config.api_key = "secret"
config.affected_user_method = :current_user
config.affected_user_identifier_methods = :loginname
config.enable_reporting = Rails.env.production?
end
in the error report, i cant find the name.
nikz
Posted on
Nov 10 2014
Heya Florian,
Sorry about the issues there.
Can you let me know which Gem version you're using - from Gemfile.lock?
Nik
florian.w
Posted on
Nov 10 2014
raygun4ruby (1.1.4)
nikz
Posted on
Nov 10 2014
Hey Florian,
Can you try running:
rake middleware
And check that Raygun::Middleware::RailsInsertAffectedUser
is in the list?
Additionally, if you log out your env hash (Rails.logger.info(request.env)) can you see a key called "raygun.affected_user"?
Nik
florian.w
Posted on
Nov 10 2014
Raygun::Middleware::RailsInsertAffectedUser is in the list
but if i log out Rails.logger.info(request.env), there is no 'raygun.affected_user'
nikz
Posted on
Nov 10 2014
You definitely have a "current_user" method on your controller?
I'm guessing this condition is where things are stopping.
florian.w
Posted on
Nov 10 2014
your link is dead.
yes, i have an current_user
method in my application_controller
.
btw. im using jruby
nikz
Posted on
Nov 10 2014
Fixed the link. Do you mind posting your middleware stack so I can check the ordering?
florian.w
Posted on
Nov 10 2014
Raygun.configuration.affected_user_method = {Symbol} current_user
florian.w
Posted on
Nov 10 2014
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x7e5d4811>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use Raygun::Middleware::RackExceptionInterceptor
use Raygun::Middleware::RailsInsertAffectedUser
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
run SECRET::Application.routes
nikz
Posted on
Nov 10 2014
Sorry, I meant the output from rake middleware
florian.w
Posted on
Nov 10 2014
btw im in trial mode.
nikz
Posted on
Nov 10 2014
Ok, so that's a bug - the middleware is in the wrong order :) I'll take a look, and let you know once I've had a chance to release a fix. Sorry about that!
nikz
Posted on
Nov 11 2014
Hey Florian,
Long time no chat :) I've made a fix that should fix your issue...
Do you mind giving this PR a go?
You should be able to install them using the git: and branch: options in your Gemfile, like so:
gem 'raygun4ruby', git: 'https://github.com/MindscapeHQ/raygun4ruby.git', branch: 'affected-user-middleware-ordering-fix'
Followed by bundle update raygun4ruby
(just in case you haven't done that before)
Let me know how you get on, either here or in the comments on that PR.
Thanks!
Nik
florian.w
Posted on
Nov 12 2014
hey nik,
I've tried the new build but still the same issue.
there is just one different, under Exception Details, there is now a Custom tab.
if i have
config.affected_user_method = :current_user
config.affected_user_identifier_methods << :loginname
where should i see the name?
nikz
Posted on
Nov 12 2014
Hey Florian,
Sorry about the problems. Can you log out your env hash before the error is sent to Raygun, and check for the "raygun.affected_user" key?
Nik
Rick Tessner
Posted on
Feb 11 2015
Having the same problem here. It appears to have started after our migration from rails 3.1.x to 4.1.9. As part of this migration, the raygun4ruby gem was upgraded from 1.1.4 to 1.1.5.
The rake middleware shows:
use ActionDispatch::SSL
use Rack::Sendfile
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007f37f2855a08>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use Raygun::Middleware::RailsInsertAffectedUser
use Raygun::Middleware::RackExceptionInterceptor
use Api::CatchExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
run Spidr::Application.routes
Versions of various bits:
raygun4ruby version: 1.1.5
ruby: 2.1.1p76
Rails: 4.1.9
The Rails.logger.info(request.env) did not show any raygun related properties. In particular, nothing about affected_user
.
Thanks for your help!
Rick
nikz
Posted on
Feb 11 2015
Hey Rick,
Have you set config.affectedusermethod in your Raygun initialiser?
Sorry about the issues! It does look like the middleware is all in the right place.
Cheers,
Nik
Rick Tessner
Posted on
Feb 11 2015
Hi,
Does it no longer default to current_user? (It seems to have previously). Will do that and see if it makes a difference.
Update: defining config.affected_user_method = :current_user
made no difference. :(
Should I downgrade to raygun4ruby to 1.1.4?
Rick
Rick Tessner
Posted on
Feb 11 2015
Hi again,
Downgrading to 1.1.4 and the user information is showing up again.
Hmmm,
Rick
nikz
Posted on
Feb 14 2015
Hi Rick,
Sounds like a regression to me. I'll need to take a look into it tomorrow, and I'll hopefully be able to give you a bell over the weekend.
Cheers,
Nik
nikz
Posted on
Feb 28 2015
Hi Rick,
Sorry for the slowness here. I've pushed a wee fix to this - can you check out this branch for me and let me know how you get on: https://github.com/MindscapeHQ/raygun4ruby/pull/61
Chers,
Nik
nikz
Posted on
Mar 11 2015
Hi Rick,
Just wondering if you've had a chance to check out the fix?
Thanks,
Nik
elkelk
Posted on
Jul 09 2015
I'm seeing the same issue with ruby 2.2.2p95, Rails 4.2.0, raygun4ruby (1.1.5). Affected User is in the middleware but not in request.env
use Rack::Sendfile
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007fab934f67a8>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use RequestStore::Middleware
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use BetterErrors::Middleware
use Raygun::Middleware::RailsInsertAffectedUser
use Raygun::Middleware::RackExceptionInterceptor
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Warden::Manager
run ...
elkelk
Posted on
Jul 09 2015
I just upgraded to raygun4ruby 1.1.6 and it works fine, so never mind...