Better Errors Gem not working in local browser, no errors visible

后端 未结 5 776
借酒劲吻你
借酒劲吻你 2021-01-01 18:17

I added the Better Errors gem to my gemfile like as seen in my gemfile below, and ran bundle and saw Using better_errors 1.1.0 and restarted my server several t

相关标签:
5条回答
  • 2021-01-01 18:41

    I am running vagrant, rails 5 and ruby 2.3 and I added the below to my config/environments/development.rb and got it working.

      # Allow usage of better_errors on Vagrant
      BetterErrors::Middleware.allow_ip! "10.0.2.2"
    
      # Show full error reports and disable caching.
      config.consider_all_requests_local = true
    

    Same answers as above but just wanted to confirm it for anyone running the rails 5 beta.

    0 讨论(0)
  • 2021-01-01 18:53

    in addition for all better you need to add this to your config/environments/development.rb:

    BetterErrors::Middleware.allow_ip! "TRUSTED_IP" where "trusted_ip" is "REMOTE_ADDR" in default error page for me it's 10.0.2.2

    0 讨论(0)
  • 2021-01-01 18:56

    In the file app/config/environments/development.rb do you have this line present in the code ?

    # Show full error reports and disable caching.
    config.consider_all_requests_local = true
    
    0 讨论(0)
  • 2021-01-01 18:58

    Valerie -- are you on a virtual machine? Better errors can sometimes not work well with VMs.

    The solution I've found is this:

    First, in your app's config/environments/development.rb (anywhere inside the configure do), add:

    BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP']
    

    Then you need to define that environment variable. Find your remote IP by firing up a browser, hitting the old error page (just throw a raise in a controller or something), and finding the "REMOTE_ADDR" in the error page's "Show env dump" section. Then copy that IP and set it as an ENV variable (in your .env or application.yml file, or wherever you keep those).

    Note -- DO NOT add that to production. It's unnecessary at best (Better Errors should only be run/included in development -- as you've ensured above).

    Then restart your server. Any chance that fixes it?

    0 讨论(0)
  • 2021-01-01 18:59

    With Vagrant, add this to your app's config/environments/development.rb (anywhere inside the configure block):

    BetterErrors::Middleware.allow_ip! "0.0.0.0/0"
    

    Then restart your server.

    (This is just a slight variation on Sasha's solution.)

    DO NOT add this to your production environment!

    0 讨论(0)
提交回复
热议问题