mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
47.02k stars 6.96k forks source link

v4.1.8 DeepL translation: 500 internal server error #26983

Closed hugogameiro closed 1 year ago

hugogameiro commented 1 year ago

Steps to reproduce the problem

On v4.1.8 click to translate content using DeepL.

Expected behaviour

Translated content

Actual behaviour

Error: 500 internal server error

Detailed description

No response

Mastodon instance

test instance

Mastodon version

v4.1.8

Browser name and version

All

Operating system

All

Technical details

Log shows:

...translate format=html controller=Api::V1::Statuses::TranslationsController action=create status=500 error='NoMethodError: undefined method `model_name' for String:Class

NoMethodError (undefined method `model_name' for String:Class
Did you mean?  module_parent):

app/controllers/api/v1/statuses/translations_controller.rb:14:in `create'
app/controllers/concerns/localized.rb:11:in `set_locale'
lib/mastodon/rack_middleware.rb:9:in `call'
lib/public_file_server_middleware.rb:18:in `call'
msviba commented 1 year ago

Same experience

Log:

[53804] *      Workers: 2
[53804] *     Restarts: (✔) hot (✖) phased
[53804] * Preloading application
[53804] * Listening on http://10.10.0.11:3000
[53804] Use Ctrl-C to stop
[53804] - Worker 0 (PID: 53870) booted in 0.01s, phase: 0
[53804] - Worker 1 (PID: 53871) booted in 0.0s, phase: 0
[ba802b48-d1a5-4618-8b98-eff9289ab70f]
[ba802b48-d1a5-4618-8b98-eff9289ab70f] NoMethodError (undefined method `model_name' for String:Class

          object.class.model_name.to_s.underscore
                      ^^^^^^^^^^^
Did you mean?  module_parent):
[ba802b48-d1a5-4618-8b98-eff9289ab70f]                             [ba802b48-d1a5-4618-8b98-eff9289ab70f] app/controllers/api/v1/statuses/translations_controller.rb:14:in `create'
[ba802b48-d1a5-4618-8b98-eff9289ab70f] app/controllers/concerns/localized.rb:11:in `set_locale'
[ba802b48-d1a5-4618-8b98-eff9289ab70f] lib/mastodon/rack_middleware.rb:9:in `call'
[5479089c-8725-4240-b940-4b26a768b4d5]                             [5479089c-8725-4240-b940-4b26a768b4d5] NoMethodError (undefined method `model_name' for String:Class                                  
          object.class.model_name.to_s.underscore                                        ^^^^^^^^^^^
Did you mean?  module_parent):
[5479089c-8725-4240-b940-4b26a768b4d5]                             [5479089c-8725-4240-b940-4b26a768b4d5] app/controllers/api/v1/statuses/
msviba commented 1 year ago

I've rolled back to 417, 416, and finally the v4.1.5 works. So bug is already in v4.1.6

spiezmaestro commented 1 year ago

I've rolled back to 417, 416, and finally the v4.1.5 works. So bug is already in v4.1.6

Can't confirm. For me it was still working fine on 4.1.7.

piotr-sikora-v commented 1 year ago

I have same issue after upgrade:

[c389af9b-77de-4565-abe8-be240ad4cc3c] method=POST path=/api/v1/statuses/111092366959816123/translate format=html controller=Api::V1::Statuses::TranslationsController action=create status=500 error='NoMethodError: undefined method `model_name' for String:Class
Did you mean?  module_parent' duration=29.57 view=0.00 db=2.58
[c389af9b-77de-4565-abe8-be240ad4cc3c]   
[c389af9b-77de-4565-abe8-be240ad4cc3c] NoMethodError (undefined method `model_name' for String:Class
Did you mean?  module_parent):
[c389af9b-77de-4565-abe8-be240ad4cc3c]   
[c389af9b-77de-4565-abe8-be240ad4cc3c] app/controllers/api/v1/statuses/translations_controller.rb:14:in `create'
[c389af9b-77de-4565-abe8-be240ad4cc3c] app/controllers/concerns/localized.rb:11:in `set_locale'
[c389af9b-77de-4565-abe8-be240ad4cc3c] lib/mastodon/rack_middleware.rb:9:in `call'
[c389af9b-77de-4565-abe8-be240ad4cc3c] lib/public_file_server_middleware.rb:18:in `call'
joenepraat commented 1 year ago

Can confirm on 4.1.8.

4.1.7 and before worked normally.

joenepraat commented 1 year ago

This has probably to do with https://github.com/mastodon/mastodon/security/advisories/GHSA-2693-xr3m-jhqr. Any idea @ClearlyClaire @Gargron etc?

joenepraat commented 1 year ago

Note: This is also an issue when using LibreTranslate.

msviba commented 1 year ago

I confirm that v4.1.8 has new bug: Not translating EN -> CZ via DeepL. When toot was already translated, it's showing the cached translation. In v4.1.7 it indeed works, but....

But in earlier versions is another bug with exactly same error message in log. And it appears during translation EN(but SK is real language) -> CZ

hugogameiro commented 1 year ago

Solved by #26990 thanks!