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

Not showing in Rails 4 #70

Closed
abuisman opened this issue Mar 24, 2014 · 34 comments
Closed

Not showing in Rails 4 #70

abuisman opened this issue Mar 24, 2014 · 34 comments

Comments

@abuisman
Copy link

When I include the gem in my rails app the profiler is not shown. However, the javascript is included and the div is created for the widget, but the final content is empty.

I tried adding Rack::MiniProfiler.authorize_request in a before_filter in my application controller: no dice.

I tried creating an initializer and add require: false in the gem file as described in the README: no profiler.

I am using puma, rails 4.0.1, and ruby ruby 2.0.0p247

Any tips?

@SamSaffron
Copy link
Member

I have not seen this reported anywhere else.

Are you seeing JS errors in chrome dev tools?

@abuisman
Copy link
Author

No nothing. I just get an empty div:

screen shot 2014-03-26 at 15 32 11

Could it be because of the bullet gem being present?

@abuisman
Copy link
Author

I removed bullet, but it didn't change anything.

@brandonparsons
Copy link

hmmmm I also lost rack mini profiler (in production only) when I swapped from unicorn to puma. I'm not sure what else I changed, but nothing else comes to mind.

@ghost
Copy link

ghost commented Apr 25, 2014

Same here with Rails 4 rails 4.0.0 and ruby 2.0.0p353

As suggested here, doesn't work either http://stackoverflow.com/questions/17025563/how-to-get-mini-profiler-to-start-in-rails

@brandonparsons
Copy link

I think I've tracked my issue down to a log permissions error. I haven't bothered to fix it yet though.

@JoshTGreenwood
Copy link

+1

@adiakritos
Copy link

I'm having the same issue. Doesn't work in rails 4 for me

@luka-n
Copy link

luka-n commented Jul 17, 2014

I have the same issue, have tracked it down to having oj_mimic_json in my Gemfile. Anyone else with this issue using the same gem?

@hunterboerner
Copy link

@lnovsak same here. oj_mimic_json breaks it.

@krim
Copy link

krim commented Aug 27, 2014

I have same issue. I have oj_mimic_json in my Gemfile. But then i removed it, problem wasn't resolved.

@arthurtalkgoal
Copy link

Same problem here. No error found in Firebug

@hakunin
Copy link

hakunin commented Nov 18, 2014

For me, removing Deflater from config/application.rb and moving it to production fixed the issue.
As suggested here:
http://stackoverflow.com/questions/17025563/how-to-get-mini-profiler-to-start-in-rails

@akshetpandey
Copy link

+1, removing oj_mimic_json and following what is mentioned about Rack::Deflater in the README solved the problem. The request for /rack-mini-profiler/result would hang the ruby process, also see my comment in #112 regarding SystemStackError

@pencilcheck
Copy link

+1, removing oj_mimic_json works. I don't get hanging of the ruby process though. Hopefully this can be fixed.

@SamSaffron
Copy link
Member

this is all very strange can someone write a test case that fails here, somehow ojs json implementation is lacking and its hurting us here.

@akshetpandey
Copy link

The issue is that OJ doesn't handle circular reference in objects. For example:
Never mind, the normal json parser doesn't handle it either.

@pencilcheck
Copy link

Oj.default_options = {
:mode => :compat,
:use_to_json => true
}

This works for me for circular references

@SamSaffron
Copy link
Member

before any of this can someone help isolate the circular ref, so we can remove it, we don't really need it in our persistence structure.

@DavidRagone
Copy link

I also had to both remove Deflator and oj_mimic_json to get this to work. Ruby 2.2, Rails 4.2.1

@eggie5
Copy link

eggie5 commented Dec 7, 2015

+1 for removing oj_mimic_json gem.

@kevinjalbert
Copy link
Contributor

Just wanted to chime in that I encountered the same issue. I had to remove the oj_mimic_json gem for this to work.

The solution that @pencilcheck suggested didn't work for me.

@jhubert
Copy link

jhubert commented Apr 5, 2016

I didn't have the oj_mimic_json gem, but removing heroku-deflator worked for me.

@thatpixguy
Copy link

We were missing the badge, and it turned out it was because we were using heroku_rails_deflate. Using heroku-deflater seems to not break the badge.

The problems seem to occur around

when body turns out not to be a String.

@Ch4s3
Copy link

Ch4s3 commented Jun 16, 2016

This still happens for me unless I remove oj_mimic_json, which I'd like to use.

@steverob
Copy link

steverob commented Jul 3, 2016

Same issue for me. Described more at #134 (comment)

Btw, I do not use oj_mimic_json or heroku_deflator

@steverob
Copy link

steverob commented Jul 3, 2016

@SamSaffron Here is a fresh Rails app (4.2.6 / 2.3.1) where this has been reproduced. https://github.com/steverob/miniprofiler-production-test

@dgynn
Copy link
Contributor

dgynn commented Jul 3, 2016

@steverob I ran your test app and was not able to reproduce the problem. The mini profiler showed up just fine on the second request.

@steverob
Copy link

steverob commented Jul 3, 2016

Really? :( let me check again.

Regards
Steve Robinson

On 03-Jul-2016, at 11:25 PM, Dave Gynn notifications@github.com wrote:

@steverob I ran your test app and was not able to reproduce the problem. The mini profiler showed up just fine on the second request.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@steverob
Copy link

steverob commented Jul 4, 2016

@dgynn yes you're right. Upon second request it shows up. No such luck for my app though. Same environment. Any ideas?

@steverob
Copy link

steverob commented Jul 4, 2016

@dgynn sorry my bad. I did not restart server after adding the authorize_request call :(. Code reloading!!

Thanks.

@brand-it
Copy link

brand-it commented Jul 6, 2016

Here is a way to get around minprofile in development mode. If you are using the oj gem and not the oj_mimic_json which really is just a small bit of code.

oj-mimic-json-1.0.1 (lib/oj_mimic_json.rb)

require 'oj'

Oj.mimic_JSON()
# Requiring json here seems to stop conflicts when requiring json in other files.
begin
  require 'json'
rescue Exception
  # ignore
end

config/initializers/oj.rb

require 'oj'

Oj.default_options = {
  mode: :compat
}

# Should be able to remove this(Rails.env.development?) once a update comes out
# https://github.com/MiniProfiler/rack-mini-profiler/pull/250
Oj.mimic_JSON unless Rails.env.development?

Basically I am turning off the OJ system in development as it is the only time we are using to try and backtrace slow queries.

@nruth
Copy link

nruth commented Jul 10, 2016

Disabling Rack::Deflater in development fixed things for me.

WhateverApp::Application.configure do
  config.middleware.insert_before ActionDispatch::Static, Rack::Deflater
end

Commenting that out and restarting rails s made the profiler work in development on rails 4.2.6 ruby 2.3.1 with the Gemfile-only default setup.

@nateberkopec
Copy link
Collaborator

Closing as stale. Linking #16.

@nateberkopec nateberkopec closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests