# TL0 Instagram 및 YouTube 링크 게시물에서 500 오류 발생

**URL:** https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359
**Category:** Bug
**Created:** [11월 17, 2020, 1:53오후 UTC](https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359 "2020-11-17T13:53:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![markersocial](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markersocial/32/170136_2.png) [@markersocial](https://meta.discourse.org/u/markersocial)
#### Post date: [11월 17, 2020, 1:53오후 UTC](https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359/1 "2020-11-17T13:53:15Z")

</div>

이상한 오류가 발생했습니다.

이것은 테스트 인스턴스에서 발생한 것이며, 테스트 통과 버전(tests-passed)에서 실행 중입니다(오류는 베타 버전과 테스트 통과 버전 모두에서 발생했습니다). 도커 매니저를 제외한 모든 플러그인을 제거하고 모든 테마 구성 요소를 삭제해 보았습니다.

안정 버전(Stable)에서 베타 버전으로, 그리고 테스트 통과 버전으로 업데이트했습니다. 힌트가 될 수 있는 점은 업데이트 후 일반 사용자 테스트 계정의 두 개의 오래된 게시물이 동일한 도메인에 대한 참조가 너무 많다는 이유로 시스템에 의해 스팸으로 표시되었다는 것입니다.

TL0 계정으로 게시물을 시도하면, 트위터와 레딧의 원박스(oneboxes)는 문제 없이 게시할 수 있습니다. 그러나 인스타그램과 유튜브 링크는 500 오류를 반환합니다. 계정의 신뢰 수준을 TL1로 올리면 링크가 정상적으로 게시됩니다(그리고 TL0로 되돌리면 계속 500 오류가 발생합니다).

또한, 유튜브와 인스타그램을 allowed\_spam\_host\_domains에 추가하면 TL0 사용자의 500 오류가 사라집니다.

로그 - 정보:

```plaintext
NoMethodError (undefined method `title' for nil:NilClass)
lib/post_action_creator.rb:264:in `create_message_creator'
lib/post_action_creator.rb:91:in `perform'
lib/post_action_creator.rb:18:in `create'
app/models/user.rb:1073:in `block in flag_linked_posts_as_spam'
app/models/user.rb:1066:in `flag_linked_posts_as_spam'
lib/new_post_manager.rb:284:in `perform_create_post'
lib/new_post_manager.rb:216:in `perform'
app/controllers/posts_controller.rb:180:in `create'
app/controllers/application_controller.rb:357:in `block in with_resolved_locale'
app/controllers/application_controller.rb:357: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'

```

로그 - 백트레이스:

```plaintext
lib/post_action_creator.rb:264:in `create_message_creator'

lib/post_action_creator.rb:91:in `perform'

lib/post_action_creator.rb:18:in `create'

app/models/user.rb:1073:in `block in flag_linked_posts_as_spam'

activerecord (6.0.3.3) lib/active_record/relation/delegation.rb:87:in `each'

activerecord (6.0.3.3) lib/active_record/relation/delegation.rb:87:in `each'

app/models/user.rb:1066:in `flag_linked_posts_as_spam'

lib/new_post_manager.rb:284:in `perform_create_post'

lib/new_post_manager.rb:216:in `perform'

app/controllers/posts_controller.rb:180:in `create'

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:357:in `block in with_resolved_locale'

i18n (1.8.5) lib/i18n.rb:313:in `with_locale'

app/controllers/application_controller.rb:357: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.2.0) lib/mini_profiler/profiling_methods.rb:85: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:40: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:354: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.2.0) lib/mini_profiler/profiler.rb:246:in `call'

message_bus (3.3.4) 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>'

```

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [11월 19, 2020, 5:41오후 UTC](https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359/2 "2020-11-19T17:41:25Z")

</div>

> [@markersocial](#):
>
> TL0 계정에 게시물을 작성하려고 하면, Twitter와 Reddit의 onebox는 문제없이 작성할 수 있습니다. 하지만 Instagram과 YouTube 링크는 500 오류가 발생합니다.

최신 Discourse 버전에서 이 문제를 재현할 수 없습니다.

Discourse 인스턴스를 최신 버전으로 업데이트한 후 [safe mode](https://meta.discourse.org/t/53504?silent=true)에서 테스트해 보실 수 있나요? 문제가 지속되면 관련 설정을 수정해 보셨는지 확인해 주시겠습니까?

---

<div class="post-metadata">

### Author: ![markersocial](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markersocial/32/170136_2.png) [@markersocial](https://meta.discourse.org/u/markersocial)
#### Post date: [11월 22, 2020, 3:51오후 UTC](https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359/3 "2020-11-22T15:51:05Z")

</div>

@techAPJ 님, 답변해 주셔서 감사합니다. 새 사용자가 ‘허용된 스팸 호스트 도메인’ 목록에 없는 동일한 도메인에 대한 링크를 게시할 때 ‘newuser spam host threshold’(새 사용자 스팸 호스트 임계값)를 초과하는 것 때문이라고 생각합니다.

특정 호스트에 국한된 문제가 아니라, TL0(신뢰 레벨 0) 사용자가 동일한 호스트를 너무 많이 게시할 때 발생하는 것 같습니다. 특정 도메인(예: IG, YouTube)에 국한된 것도 아닙니다.

플러그인(docker manager 제외)이나 템플릿 없이 최신 Discourse(테스트 통과 2.6.0beta6)로 업데이트한 후, 테스트 인스턴스(TL0 일반 사용자)에서 아래 사항을 확인했습니다:

- newuser spam host threshold를 1 증가시키면, 해당 사용자는 동일한 도메인에 대한 링크를(500 오류를 발생시키며) 한 번 더 게시할 수 있습니다. 다음 게시 시 500 오류가 발생합니다. 이는 반복적으로 재현됩니다.

- 해당 도메인을 allowed spam host domains에 추가하면, 오류 없이 해당 도메인 URL을 자유롭게 계속 게시할 수 있습니다.

- 사용자의 신뢰 레벨을 1로 올리면, 오류 없이 해당 도메인 URL을 계속 게시할 수 있습니다.

위 정보로 재현이 불가능하다면 알려주세요. [safe mode](https://meta.discourse.org/t/53504?silent=true)로 테스트를 진행하겠습니다.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [4월 29, 2021, 4:28오후 UTC](https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359/5 "2021-04-29T16:28:35Z")

</div>

> [@markersocial](#):
>
> 특정 호스트에 국한된 문제인 것 같지 않고, TL0 사용자가 동일한 호스트에 대해 너무 많이 게시한 경우에만 발생하는 것으로 보입니다. 특정 도메인(예: IG, YouTube)에 국한된 것도 아닌 것 같습니다.

이 문제를 자세히 살펴보고 있는데, 버그가 아니라 의도된 동작으로 보입니다.

새 사용자는 동일한 호스트의 링크를 너무 많이 게시할 수 없으며, 관리자가 이 동작을 무시하려면 `newuser_spam_host_threshold`와 `allowed_spam_host_domains` 사이트 설정을 조정하면 됩니다.

이것은 반복된 링크로 인해 게시물이 차단될 때 보내는 스태프 메시지에도 반영되어 있습니다:

> <https://github.com/discourse/discourse/blob/cd93d1b5f76aa8b696783f2c5a7edf2920ef8254/config/locales/server.en.yml#L3351-L3359>

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [4월 30, 2021, 4:28오후 UTC](https://meta.discourse.org/t/500-error-for-tl0-instagram-youtube-link-posts/170359/6 "2021-04-30T16:28:10Z")

</div>

이 주제는 23시간 후 자동으로 닫혔습니다. 더 이상 새 답변을 게시할 수 없습니다.
