User Messages Inbox Error 500

Hey there,

we are experiencing super weird behavior, but currently just from one single user, when opening the messages inbox.

We run discourse in docker on Appache with ProxyPass Discourse 2.6.0.beta3

The one user cant dropdown the messages panes, there is the note “No Content” or what ever the englisch original is for “Keine Inhalte” – we run de.DE :wink:

And when now clicking again on the messages icon, well lets say, when the user tries to open the messages inbox, we get an 500 Error.

The page says "error on loading: [/topics/private-messages/firstname.name.json]

This happens just for one given user. Other do not having this problem.

If the user tries https://domain.de/u/firstname.name/messages/sent or https://domain.de/u/firstname.name/messages/group/any everythings fine.

But https://domain.de/u/firstname.name/messages/ or https://domain.de/u/firstname.name/messages/inbox happens to give error 500.

We tried to change roles of this user, we made updates and rebuild the app via launcher. But unfortunately it happens to still give a error 500 when opening the inbox.

Does anyone ever had such behavior. What can we do? Is there a way to rebuild the messages? Or do we have to delete them?

Please give some advice we are currently lost.

Thanks in advance!

I saw something similar the other day, with a group name in /topics/private-messages-group. It turned out that there was a case sensitive search, and the group name in the URL was all in lowercase.

Can you check if this behaves differently if you change the case in the URL to match the case of the username? (so something like https://domain.de/u/Firstname.Name/messages)

5 Likes

Hey Richard,

thank you for the fast response!

I tried to changes cases, like you suggested

  • …Firstname.Name…

also I tried different cases

  • …firstname.Name…
  • …Firstname.name…
  • …FIRSTNAME.NAME…

But still same error.

I tried tried https://domain.de/u/Firstname.Name/messages/sent and other routes, that worked perfectly fine, as before.

So any hints on that?

I would be very thankful for help.

This was a bit of a long shot already so I am afraid I am not even able to give you any hints on this.

2 Likes

No problem, you never know, right? Am happy with any help.

Maybe some else can throw something in?
Thank you!

Hey there,

I really hope some could help me with our problem. As far as @RGJ hints, we found out, that things seem to lie a bit deeper, but we could not solve the problem, of unreachable inboxes of a single user, yet. Unfortunately we really use messages a lot. We are kind of organized in small groups that often need to communicate not public. Therefor messages are a perfect way to got.

If you some more information, let me know or logging, tell me what and I will paste it here.

Thank you all for further hints and still for reading :wink:

Did you check the error logs via web browser when logged in as admin?

@codinghorror thank you so much for further assistance.

In fact there is a quite long error output concerning this request. But I can’t solve this.

I try to put the logging information here

Message (21 copies reported)

NoMethodError (undefined method `downcase' for nil:NilClass)
app/models/global_setting.rb:107:in `s3_bucket_name'
app/models/site_setting.rb:157:in `absolute_base_url'
app/models/upload.rb:184:in `secure_media_url_from_upload_url'
lib/url_helper.rb:60:in `secure_proxy_without_cdn'
lib/url_helper.rb:90:in `cook_url'
app/models/topic.rb:126:in `image_url'
app/serializers/listable_topic_serializer.rb:34:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
app/controllers/application_controller.rb:451:in `serialize_data'
app/controllers/application_controller.rb:460:in `render_serialized'
lib/topic_list_responder.rb:16:in `block (2 levels) in respond_with_list'
lib/topic_list_responder.rb:9:in `respond_with_list'
app/controllers/list_controller.rb:177:in `message_route'
app/controllers/list_controller.rb:164:in `block in generate_message_route'
app/controllers/application_controller.rb:351:in `block in with_resolved_locale'
app/controllers/application_controller.rb:351:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:336:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
lib/middleware/request_tracker.rb:176:in `call'

Backtrace

app/models/global_setting.rb:107:in `s3_bucket_name'
app/models/site_setting.rb:157:in `absolute_base_url'
app/models/upload.rb:184:in `secure_media_url_from_upload_url'
lib/url_helper.rb:60:in `secure_proxy_without_cdn'
lib/url_helper.rb:90:in `cook_url'
app/models/topic.rb:126:in `image_url'
app/serializers/listable_topic_serializer.rb:34:in `image_url'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:124:in `block in serialize'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:123:in `map'
active_model_serializers (0.8.4) lib/active_model/serializer/associations.rb:123:in `serialize'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:368:in `block in include_associations!'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:367:in `each_key'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:367:in `include_associations!'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:362:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:343:in `as_json'
app/controllers/application_controller.rb:451:in `serialize_data'
app/controllers/application_controller.rb:460:in `render_serialized'
lib/topic_list_responder.rb:16:in `block (2 levels) in respond_with_list'
actionpack (6.0.3.3) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
lib/topic_list_responder.rb:9:in `respond_with_list'
app/controllers/list_controller.rb:177:in `message_route'
app/controllers/list_controller.rb:164:in `block in generate_message_route'
actionpack (6.0.3.3) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.0.3.3) lib/abstract_controller/base.rb:195:in `process_action'
actionpack (6.0.3.3) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.0.3.3) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.0.3.3) lib/active_support/callbacks.rb:112:in `block in run_callbacks'
app/controllers/application_controller.rb:351:in `block in with_resolved_locale'
i18n (1.8.5) lib/i18n.rb:313:in `with_locale'
app/controllers/application_controller.rb:351:in `with_resolved_locale'
activesupport (6.0.3.3) lib/active_support/callbacks.rb:121:in `block in run_callbacks'
activesupport (6.0.3.3) lib/active_support/callbacks.rb:139:in `run_callbacks'
actionpack (6.0.3.3) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.0.3.3) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.0.3.3) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
activesupport (6.0.3.3) lib/active_support/notifications.rb:180:in `block in instrument'
activesupport (6.0.3.3) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.0.3.3) lib/active_support/notifications.rb:180:in `instrument'
actionpack (6.0.3.3) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
actionpack (6.0.3.3) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (6.0.3.3) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.0.3.3) lib/abstract_controller/base.rb:136:in `process'
actionview (6.0.3.3) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (2.1.0) lib/mini_profiler/profiling_methods.rb:78:in `block in profile_method'
actionpack (6.0.3.3) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.0.3.3) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:49:in `block in serve'
actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.0.3.3) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.0.3.3) lib/action_dispatch/routing/route_set.rb:834:in `call'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:336:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/cookies.rb:648:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.0.3.3) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (6.0.3.3) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster (2.9.4) lib/logster/middleware/reporter.rb:43:in `call'
railties (6.0.3.3) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.0.3.3) lib/rails/rack/logger.rb:28:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/request_id.rb:27:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.0.3.3) lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
rack-mini-profiler (2.1.0) lib/mini_profiler/profiler.rb:235:in `call'
message_bus (3.3.2) lib/message_bus/rack/middleware.rb:61:in `call'
lib/middleware/request_tracker.rb:176:in `call'
railties (6.0.3.3) lib/rails/engine.rb:527:in `call'
railties (6.0.3.3) lib/rails/railtie.rb:190:in `public_send'
railties (6.0.3.3) lib/rails/railtie.rb:190:in `method_missing'
rack (2.2.3) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.3) lib/rack/urlmap.rb:58:in `each'
rack (2.2.3) lib/rack/urlmap.rb:58:in `call'
unicorn (5.7.0) lib/unicorn/http_server.rb:632:in `process_client'
unicorn (5.7.0) lib/unicorn/http_server.rb:728:in `worker_loop'
unicorn (5.7.0) lib/unicorn/http_server.rb:548:in `spawn_missing_workers'
unicorn (5.7.0) lib/unicorn/http_server.rb:144:in `start'
unicorn (5.7.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/2.6.0/bin/unicorn:23:in `load'
vendor/bundle/ruby/2.6.0/bin/unicorn:23:in `<main>'

ENV

hostname config-app
process_id 273
application_version 891987a2843de3ebeed412e01fd6b8064dac3917
HTTP_HOST sub.domain…de
REQUEST_URI /topics/private-messages/firstname.name.json
REQUEST_METHOD GET
HTTP_USER_AGENT Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:81.0) Gecko/20100101 Firefox/81.0
HTTP_ACCEPT application/json, text/javascript, /; q=0.01
HTTP_REFERER https://sub.domain.de/u/firstname.name/messages
HTTP_X_FORWARDED_FOR 2003:d6:9720:2500:c4b4:5a78:fb34:fbe8, unix:
HTTP_X_REAL_IP unix:
username firstname.name
time 8:38 pm

Well this is a lot and I do not have a clue where to look in. I hope this can bring some light to our problem. If you need any further information, please let me know.

Thank you so much for taking a look into that!
THX

1 Like

Is your s3_bucket_name invalid?

Thanks for the reply,

short answer: I do not know, I do not think so.

S3 Bucket Name seems to be something connected to the S3 Amsazon Storage Systems right? And if so, no probably it can’t be invalid. We never configured one. We are running dockerized discourse on a reverse proxy apache domain.

And should not crash a lot more if S3 Bucket is invalid, not just one route of one user?

Please, do not get me wrong. I might be on a total wrong path here. As I said, I am not that sure what this s3_bucket_name is or lets say – when I understood it right – why it should be configured.

Can I look it up in admin panel or do I need to check docker-compose?

Sorry for the time delay … different time zones and work hours … you know.

But thanks a lot for having an eye on it!

As I had a look into the setting every s3 option is empty. As I would say it should be? As we do not use SE Buckets? Or do I get it wrong?

Did you enable the secure media site setting?

No, not really as far as I understand the setting. We activated the secure media email option yet.

As we did not experience this error from the beginnen might this be caused by a embeded image that was sent via mail?

Should I try to deactivate this option?

But as I said

So secure media should not work with no s3 credentials set at all, right?

2 Likes

Is there still know one here, having any idea, what we could try?

Well, the thing ist, that we have this issue for one of our admins and it makes it pretty hard to communicate having one admin, thats not able to answer to messages or view them.

For the moment it would be a solution if the messages inbox would be reachable again. So is there any hack or possibility to rebuild one single user account or to – I don’t know – delete all messages for one single user? So that we could start from the scratch with this account?

Moreover I was even thinking about, deleting this account, but as far as I got it deleting users is not possible. What else could we try to start a new account for this user, that participating is possible again?

Please, let me know what Ideas you have, I am lost her.

Thanks in advance.

Sorry I nee to ask again. As far as we still have this problem.

Did you mean to ask if we enables secue media as a part of the problem or the solution?

We do not have this option activated. Should we?

Or should we leave it like we have it and hope for other hints to get it fixed?

1 Like

Hi,
looks like I am facing a similar problem here. The messages for a single user, as far as we know, are not working.
Any further ideas, what we can have a look at??

1 Like

According to Jay :

I’d try to replace the condition where("user_id > 0") by something like where("user_id = the-id-of-your-user")

About the why this is happening? my bet would be something localized, I myself sometime have trouble with quotation marks, accents, etc… :wink:

1 Like

Mhm this sounds like giving it a shot.

Thinking about localization I was wondering if the behavior should change, by changing users interface setttings? Any thoughts on that?

I will try the deletion solution in the next few days.

Thanks for your help.

I the meantime we thought around a bit. Maybe anyone else has some input to share.

An other strange thing is, the in the messeage pane area, by clinking on the user icon and the clicking the envelope. There should be displayed all recent messages, right? In the case of our users that is not able to open the inbox there is just nothing?

Maybe someone has some ideas on that. When we can for sure say that there sould be listed some entries.

no_messages

Maybe this will point some ideas in any direction?

And some other route of thinking. We still have some kind off ssl error on our site. As I said, running discourse with docker on a reverse proxy on apache. But the domain has its working ssl cert by lets encrypt.

Still we have some mixed content warnings on the site. By any means the standard logos and favicons are served by http. We deleted the custom brandings in behalf of getting rid of the mixed content errors.

So is there any chance that this might cause the problem?

When we recently hit the JSON route `https://sub.domain.de/topics/private-messages/firstnamename.json

The JSON result is

{
	"status":500,
	"error":"Internal Server Error"
}

I closer look into logs brought up this

NoMethodError (undefined method `downcase' for nil:NilClass)
app/models/global_setting.rb:107:in `s3_bucket_name'
app/models/site_setting.rb:157:in `absolute_base_url'
app/models/upload.rb:184:in `secure_media_url_from_upload_url'
lib/url_helper.rb:60:in `secure_proxy_without_cdn'
lib/url_helper.rb:90:in `cook_url'
app/models/topic.rb:126:in `image_url'
app/serializers/listable_topic_serializer.rb:34:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
app/controllers/application_controller.rb:454:in `serialize_data'
app/controllers/application_controller.rb:463:in `render_serialized'
lib/topic_list_responder.rb:16:in `block (2 levels) in respond_with_list'
lib/topic_list_responder.rb:9:in `respond_with_list'
app/controllers/list_controller.rb:177:in `message_route'
app/controllers/list_controller.rb:164:in `block in generate_message_route'
app/controllers/application_controller.rb:354:in `block in with_resolved_locale'
app/controllers/application_controller.rb:354:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:354:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
lib/middleware/request_tracker.rb:176:in `call'

As we are not using secure media and no s3 either I still stumble over these entries:

app/models/site_setting.rb:157:in `absolute_base_url'
app/models/upload.rb:184:in `secure_media_url_from_upload_url'
lib/url_helper.rb:60:in `secure_proxy_without_cdn'

So any chance that this might be cause by a mixed content error under the hood?

Thanks for still haning in there.

1 Like