# 用户消息收件箱 Error 500

**URL:** https://meta.discourse.org/t/user-messages-inbox-error-500/165937
**Category:** Self-hosting
**Created:** [2020年十月1日 15:27 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937 "2020-10-01T15:27:38Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月1日 15:27 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/1 "2020-10-01T15:27:38Z")

</div>

嘿，大家好，

我们遇到了一个非常奇怪的问题，但目前只影响单个用户，问题出现在打开消息收件箱时。

我们在 Docker 中运行 Discourse，并通过 Apache 的 ProxyPass 进行代理，Discourse 版本为 2.6.0.beta3。

该用户无法下拉消息面板，面板上显示的是“无内容”或类似“Keine Inhalte”的英文原文——我们使用的是 [de.DE](http://de.DE) 语言环境。

当该用户再次点击消息图标（即尝试打开消息收件箱）时，会出现 500 错误。

页面显示：`"加载错误：[/topics/private-messages/firstname.name.json]"`

这个问题仅针对特定用户，其他用户没有遇到此问题。

如果该用户访问 [https://domain.de/u/firstname.name/messages/sent](https://domain.de/u/firstname.name/messages/sent) 或 [https://domain.de/u/firstname.name/messages/group/any，一切正常。](https://domain.de/u/firstname.name/messages/group/any%EF%BC%8C%E4%B8%80%E5%88%87%E6%AD%A3%E5%B8%B8%E3%80%82)

但访问 [https://domain.de/u/firstname.name/messages/](https://domain.de/u/firstname.name/messages/) 或 [https://domain.de/u/firstname.name/messages/inbox](https://domain.de/u/firstname.name/messages/inbox) 时，会返回 **500 错误** 。

我们尝试更改该用户的角色，进行了更新，并通过 launcher 重建了应用。但不幸的是，打开收件箱时仍然会出现 **500 错误** 。

是否有人遇到过类似行为？我们可以做些什么？是否有办法重建消息？还是必须删除它们？

请提供一些建议，我们现在有些不知所措。

提前感谢！

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2020年十月1日 15:42 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/2 "2020-10-01T15:42:39Z")

</div>

> [@v.stephan](#):
>
> 页面显示 `“加载错误：[/topics/private-messages/firstname.name.json]`
> 
> 这个问题仅出现在某个特定用户身上，其他用户没有遇到此问题。

我前几天也看到了类似的情况，当时是在 `/topics/private-messages-group` 中涉及组名。后来发现是大小写敏感的搜索，而 URL 中的组名全是小写。

你能否检查一下，如果你将 URL 中的大小写改为与用户名的大小写一致（例如 `https://domain.de/u/Firstname.Name/messages`），行为是否会不同？

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月2日 07:55 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/3 "2020-10-02T07:55:43Z")

</div>

嘿，Richard，

感谢你的快速回复！

我尝试了按照你的建议更改大小写：

- `…Firstname.Name…`

我还尝试了其他不同的大小写组合：

- `…firstname.Name…`
- `…Firstname.name…`
- `…FIRSTNAME.NAME…`

但 **仍然出现相同的错误** 。

我尝试了 `https://domain.de/u/Firstname.Name/messages/sent` 以及其他路由，这些路径和以前一样运行正常。

对此你有什么建议吗？

非常感谢您的帮助。

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2020年十月2日 07:57 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/4 "2020-10-02T07:57:13Z")

</div>

这本来就不太靠谱，所以我恐怕连一点提示都帮不上你。

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月2日 08:51 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/5 "2020-10-02T08:51:49Z")

</div>

没问题，谁说得准呢，对吧？我很感激任何帮助。

也许其他人能提供一些建议？  
谢谢！

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月5日 17:15 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/6 "2020-10-05T17:15:11Z")

</div>

大家好，

我真的很希望能有人帮我们解决这个难题。正如 @RGJ 所暗示的那样，我们发现问题的根源似乎更深， **但到目前为止，我们仍无法解决单个用户收件箱无法访问的问题。** 不幸的是，我们确实非常依赖消息功能。我们通常以小组形式组织，这些小组经常需要进行非公开沟通。因此，消息功能对我们来说非常理想。

如果您需要更多信息，请告诉我；如果需要日志，也请告诉我具体需要哪些，我会将其粘贴到这里。

感谢大家提供的进一步建议，也感谢各位的阅读 😉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2020年十月5日 17:24 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/7 "2020-10-05T17:24:00Z")

</div>

您以管理员身份登录并通过网页浏览器检查错误日志了吗？

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月5日 18:50 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/8 "2020-10-05T18:50:25Z")

</div>

@codinghorror 非常感谢您的进一步帮助。

事实上，关于此请求有一个相当长的错误输出。但我无法解决它。

我尝试在此处提供日志信息

### 消息（报告了 21 份副本）

```plaintext
NoMethodError (nil:NilClass 没有 `downcase' 方法)
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'

```

### 回溯

```plaintext
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>'

```

### 环境变量

| 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](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 |

这确实很多，我也不知道该从哪里入手。希望这些信息能为我们解决问题提供一些线索。如果您需要更多信息，请随时告诉我。

非常感谢您花时间查看这个问题！  
THX

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2020年十月6日 05:33 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/9 "2020-10-06T05:33:34Z")

</div>

> [@v.stephan](#):
>
> ```plaintext
> NoMethodError (undefined method `downcase' for nil:NilClass)
> app/models/global_setting.rb:107:in `s3_bucket_name'
> 
> ```

你的 s3\_bucket\_name 是否无效？

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月6日 14:35 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/10 "2020-10-06T14:35:41Z")

</div>

感谢您的回复，

简短回答：我不知道，我想不是。

S3 存储桶名称似乎与 S3 Amazon 存储系统有关，对吧？如果是这样，它应该不会无效。我们从未配置过它。我们在反向代理 Apache 域名上运行 Docker 化的 Discourse。

如果 S3 存储桶无效，难道不应该导致更多崩溃，而不仅仅是某个用户的一个路由吗？

请不要误会我。我可能完全走错了方向。正如我所说的，我不太确定这个 s3\_bucket\_name 是什么，或者说——如果我理解正确的话——为什么需要配置它。

我可以在管理面板中查找它，还是需要检查 docker-compose？

抱歉延迟回复……时区和工作时间不同……您懂的。

但非常感谢您关注此事！

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月6日 14:39 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/11 "2020-10-06T14:39:24Z")

</div>

我查看了设置，每个 S3 选项都是空的。这是否如我所说是正常的？因为我们不使用 SE 存储桶？还是我理解错了？

 ![s3_setting](https://global.discourse-cdn.com/meta/original/3X/7/7/77ffae5fd3a3d93cf99a5409e216493a8201ce04.png)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2020年十月6日 15:17 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/12 "2020-10-06T15:17:46Z")

</div>

> [@v.stephan](#):
>
> `app/models/upload.rb:184:in `secure\_media\_url\_from\_upload\_url’`

您是否启用了“安全媒体”站点设置？

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月6日 16:51 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/13 "2020-10-06T16:51:38Z")

</div>

不，根据我对该设置的理解，并非如此。我们尚未启用安全媒体邮件选项。

 ![secure-media](https://global.discourse-cdn.com/meta/original/3X/a/8/a81170288261d48a1a45750bba4af7559868b69b.png)

由于我们从一开始就没有遇到过此错误，这是否可能是由通过邮件发送的嵌入图片引起的？

我应该尝试停用此选项吗？

但正如我所说：

> [@v.stephan](#):
>
> 请不要误会我。我可能完全走错了方向。正如我所说，我不太确定 s3\_bucket\_name 是什么，或者说——如果我的理解正确的话——为什么需要对其进行配置。

因此，如果根本没有设置 S3 凭证，安全媒体功能应该无法工作，对吗？

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月12日 14:06 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/14 "2020-10-12T14:06:03Z")

</div>

还有人在这里吗？有什么想法我们可以尝试一下吗？

问题是，我们的一位管理员遇到了这个问题，导致他无法回复或查看消息，这给我们的沟通带来了很大困难。

目前，如果能重新访问消息收件箱，就能解决问题。那么，有没有什么方法可以重建单个用户账户，或者——我也不确定——删除某个用户的所有消息？这样我们就可以从这个账户重新开始。

此外，我甚至考虑过删除这个账户，但据我所知，删除用户是不可能的。我们还能尝试什么方法来为这个用户创建一个新账户，让他能够再次参与？

请告诉我你们有什么想法，我现在有点不知所措。

提前感谢。

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月16日 07:33 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/15 "2020-10-16T07:33:37Z")

</div>

抱歉，我需要再次询问。既然我们仍面临这个问题，您的意思是询问我们是否将“安全媒体”（secure media）作为问题的一部分还是解决方案的一部分启用？

我们目前并未启用此选项。我们应该启用它吗？

还是应该保持现状，并期待其他提示来解决问题？

---

<div class="post-metadata">

### Author: ![Daniel\_Tesla](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_tesla/32/138185_2.png) [@Daniel\_Tesla](https://meta.discourse.org/u/Daniel_Tesla)
#### Post date: [2020年十月17日 19:39 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/16 "2020-10-17T19:39:31Z")

</div>

您好，  
看起来我们遇到了类似的问题。据我们所知，单个用户的消息功能无法正常工作。  
是否还有其他建议，我们可以进一步排查？

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [2020年十月17日 20:14 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/17 "2020-10-17T20:14:08Z")

</div>

> [@v.stephan](#):
>
> 还是说我们必须删除它们？

根据 Jay 的说法：

> [@pfaffman](#):
>
> 它将删除所有非系统用户或 discobot 创建的私信。它仍会删除任何其他私信，包括来自管理员的私信。
> 
> 此操作尚未经过测试。我并非建议这是一个好主意。我无法保证它不会造成不良后果。
> 
> ```plaintext
> cd /var/discourse
> discourse backup
> ./launcher enter app
> rails s
> Topic.where(archetype: 'private_message').where("user_id > 0").destroy_all
> exit
> discourse enable_restore
> discourse restore
> 
> ```
> 
> 如果未发生不良情况，您可以省略最后两步。如果发生了不良情况，您需要复制/粘贴 `discourse restore` 命令输出的最新备份，以恢复备份。

我建议您尝试将条件 `where("user_id > 0")` 替换为类似 `where("user_id = 您的用户 ID")` 的形式。

至于为什么会发生这种情况？我猜可能是某种本地化问题。我自己有时也会遇到引号、重音符号等方面的问题……😉

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月18日 15:04 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/18 "2020-10-18T15:04:51Z")

</div>

嗯，这听起来值得一试。

关于本地化，我在想是否应该通过更改用户的界面设置来调整这一行为？对此您有什么看法吗？

我将在接下来的几天内尝试删除方案。

感谢您的帮助。

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月18日 15:10 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/19 "2020-10-18T15:10:05Z")

</div>

在此期间，我们进行了一些思考。也许其他人也有什么建议可以分享。

另一个奇怪的问题是：在消息面板区域，点击用户图标，然后点击信封图标。按理说应该会显示所有最近的邮件，对吧？但在我们用户的案例中，如果无法打开收件箱，那里就什么都没有？

也许有人对此有一些想法。因为我们完全可以确定这里应该列出一些条目。

 ![no_messages](https://global.discourse-cdn.com/meta/original/3X/9/8/98ae432aaeb9cb5e42ad3f3b494e1a0bbec0ceaf.png)

这是否能给某些方向带来一些启发？

---

<div class="post-metadata">

### Author: ![v.stephan](https://avatars.discourse-cdn.com/v4/letter/v/85f322/32.png) [@v.stephan](https://meta.discourse.org/u/v.stephan)
#### Post date: [2020年十月18日 15:20 UTC](https://meta.discourse.org/t/user-messages-inbox-error-500/165937/20 "2020-10-18T15:20:09Z")

</div>

还有一些其他的思路。我们的网站仍然存在某种 SSL 错误。正如我之前所说，我们在 Apache 反向代理上使用 Docker 运行 Discourse，但该域名已通过 Let’s Encrypt 配置了正常的 SSL 证书。

不过，网站上仍然出现了一些混合内容警告。标准徽标和网站图标似乎是通过 HTTP 提供的。为了消除混合内容错误，我们已经删除了自定义品牌设置。

那么，这是否可能是导致问题的原因呢？

最近当我们访问 JSON 路由 `https://sub.domain.de/topics/private-messages/firstnamename.json` 时，返回的 JSON 结果为：

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

```

仔细查看日志后，发现了以下错误：

```log
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'

```

由于我们并未使用安全媒体或 S3，我仍然对这些条目感到困惑：

```log
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'

```

那么，这是否可能是由底层的混合内容错误引起的呢？

感谢你们一直以来的支持。

[下一頁](https://meta.discourse.org/t/user-messages-inbox-error-500/165937.md?page=2)
