-
Notifications
You must be signed in to change notification settings - Fork 108
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
Rails 7.1's new BroadcastLogger causes TypeError in Vonage::Config #288
Comments
Although I'm unfamiliar with Sorbet, I can send an easy patch to change the type definition like the one below. I don't know if it's valid and appropriate. sig { params(logger: T.nilable(
defined?(ActiveSupport::BroadcastLogger) ?
T.any(::Logger, Vonage::Logger, ActiveSupport::BroadcastLogger) # rails 7.1.0 introduced
: T.any(::Logger, Vonage::Logger)
)).returns(T.nilable(Vonage::Logger)) }
def logger=(logger)
end |
Just to let you know, I found a runtime check behavior configuration of Sorbet. https://sorbet.org/docs/tconfiguration#errors-from-invalid-method-calls After executing the following code, my code stopped raising a TypeError. I feel weird about writing a config for Sorbet even though I don't use Sorbet as a user. 😓 T::Configuration.call_validation_error_handler = lambda do |signature, opts|
puts opts[:message]
end Or, https://sorbet.org/docs/tconfiguration#sorbet_runtime_default_checked_level |
Thanks @ohbarye. I'll look into getting a fix out for this. |
same issue here, is there any workarround? |
@matedemorphy I'm working on a PR which basically implements @ohbarye's solution. I just need to do a bit more testing, but it should hopefully be released later today. |
@ohbarye @matedemorphy the PR is now merged and released as v7.16.1 and available on RubyGems |
Fixed in #290 |
@superchilled Thank you for your quick fix! |
Thanks @ohbarye 🙇 |
Problem
Rails 7.1 introduced
ActiveSupport::BroadcastLogger
and it violates vonage's type definition.ref rails/rails#48615
Reproduce procedure
Call
Vonage::Client.new
with rails 7.1.0 and vonage 7.16.0.Expected Behavior
No error happens.
Actual Behavior
It raises
TypeError
.Cause
That's because vonage's type definition does not allow a class that does not inherits
Logger
unlikeActiveSupport::Logger
.ref
vonage-ruby-sdk/lib/vonage/config.rb
Lines 133 to 135 in b3122cb
Other information
Here is the difference of
Rails.logger
between 7.0.8 and 7.1.0.The text was updated successfully, but these errors were encountered: