-
Notifications
You must be signed in to change notification settings - Fork 442
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
Component renders "" (blank) when an error is raised during the render phase #1981
Comments
@mjacobus if you are able to add failing tests in a pr it would help a lot, otherwise someone will be able to do it |
Update: I downgraded view_component to |
@reeganviljoen noted! 👍🏻 I will dig some more, and I come back to it. |
I found the culprit. That is https://github.com/newrelic/newrelic-ruby-agent. It overrides the render method: Then rescues exceptions, and don't raise again: |
@mjacobus i also use new relic + view_component I will issue a bug report if you haven't already |
Thank you @reeganviljoen. This is the PR that introduced this behavior: https://github.com/newrelic/newrelic-ruby-agent/pull/2367/files#r1463895980 |
We should be able to se error pages, specially in when Rails.env is development. The piece of code that was removed here prevented from happening. Instead, it would have the `render_in` method return `nil` when an error happened, resulting in either a blank page, or an incomplete page. I believe we also want to raise errors in production. We should not make a decision here, whether the error should be suppressed. Otherwise we are making the assumption "incomplete pages are better than error pages", which may be the correct assumption under some circumstances, but not under other circumstances. Fixes ViewComponent/view_component#1981
Here's a PR that should fix the issue: newrelic/newrelic-ruby-agent#2410 |
We should be able to se error pages, specially in when Rails.env is development. The piece of code that was removed here prevented from happening. Instead, it would have the `render_in` method return `nil` when an error happened, resulting in either a blank page, or an incomplete page. I believe we also want to raise errors in production. We should not make a decision here, whether the error should be suppressed. Otherwise we are making the assumption "incomplete pages are better than error pages", which may be the correct assumption under some circumstances, but not under other circumstances. Fixes ViewComponent/view_component#1981
@mjacobus what a legend, can't wait for them to fix it 🙏 |
For the record, we can disable view component instrumentation with the # config/newrelic.yml
common: &default_settings
# [...]
instrumentation.view_component: disabled |
We should be able to se error pages, specially in when Rails.env is development. The piece of code that was removed here prevented from happening. Instead, it would have the `render_in` method return `nil` when an error happened, resulting in either a blank page, or an incomplete page. I believe we also want to raise errors in production. We should not make a decision here, whether the error should be suppressed. Otherwise we are making the assumption "incomplete pages are better than error pages", which may be the correct assumption under some circumstances, but not under other circumstances. Fixes ViewComponent/view_component#1981
@mjacobus You are a legend, thank you so much! |
Steps to reproduce
Render a component from a controller
Expected behavior
I expected to see the rails error page.
Actual behavior
A blank page.
A few things worth noting
The page will render:
So all of that, makes me believe that the error suppressing is happening during the rendering phase.
Backtrace:
System configuration
Rails version:
Rails 7.0.8
Ruby version:
ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-darwin21]
Gem version:
view_component (3.10.0)
,view_component (3.5.0)
,view_component (3.0.0)
(without theerb_template
syntax.The text was updated successfully, but these errors were encountered: