-
Notifications
You must be signed in to change notification settings - Fork 435
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
Doesn't work with rails mountable engine #93
Comments
In case of this error, the AJAX request path will be something like '/raise_engine_error/__better_errors/70198016361960/variables' instead of just '/__better_errors/70198016361960/variables', so better_errors middleware doesn't match the regexp and passes the request over to the app. I haven't figured out why the path is different yet. |
@rgt600: What happens if you click "All frames"? |
Also, how do I get the sample app you provided running? |
Replace gemspec path: '~/dev/better_errors_engine_error' with gemspec path: '../..' in test/dummy/Gemfile |
better_errors prefixes its API calls with uri_prefix which is env["SCRIPT_NAME"], but the regex only matches the root path. In case of better_errors_engine_error, env["SCRIPT_NAME"] will be '/better_errors_engine_error'. |
@virusman: thanks for your investigation! If I understand you right, this issue is unfixable with gem's current architecture, isn't it? @charliesome: sorry for inconvenience with my rep. It should work now. And it's bundled against gem's edge (with virusman's fix) |
I think with my PR (#103) this should be fixed. |
Fixed in #103. |
Hi! I encountered a problem with simultaneous use of better_errors and rails mountable engines.
If you mount rails engine at some enterpoint in your main app routes, errors which are happened in the app would be normally rendered by the gem. However, errors in the engine code would be rendered partially.
This screenshot shows error in main app code.

And this screen shows error in code which is covered by rails engine. It's almost empty.

In logs you could see something like that
ActionController::RoutingError (No route matches [POST] "/raise_engine_error/__better_errors/70309963973640/variables")
As far as I know rails mountable engines work like middlewares so problem should be with better_errors middleware injection.
I also prepared a dummy app with simple rails engine to check the problem in live:
https://github.com/rgt600/better_errors_engine_error
Just clone it, cd to ./test/dummy, bundle install (it's isolated so safe for your env), "bundle e rails s" and go in your browser to /raise_engine_error. It would be broken. And if you go to /raise_app_error page would be rendered normally.
Thanks for any help!
The text was updated successfully, but these errors were encountered: