Error trying to edit a post with an image in (NginX Proxy Manager?)

I am getting an error trying to save a post after editing it in 2.9.0.beta4. The error is a 500 error and from all appearances it looks like it cannot save a draft. I previously had some file ownership errors in this version. Can anyone tell me the path where both posts and drafts are stored so that I can check the ownership and protection?

This seems too simple an answer, so I apologise if I’ve misjudged it, but if you’re using the Data Explorer Plugin the posts are in the posts table, and the drafts in the drafts table.

Is there an error in your browser console that can add some extra detail to what’s not working?

I am not using the Explorer Plugin. It appears that this happens when editing documents with inline graphics. Perhaps the protect is not right on the folder where they are stored? Do you know where that is?

1 Like

As @JammyDodger mentioned, the vast majority of Discourse data is stored in the postgres database, so it’s unlikely you’ll have ‘file ownership’ issues there which only affect some Discourse functions.

In a standard installation, uploads are stored under /var/discourse/shared/standalone/.... That directory is then mounted inside the docker container. It’s possible there is a permissions issue there :+1:

To be sure, the cause of the 500 errors should be visible in your site’s error logs. When logged in as an administrator, visit /logs and look for recent red errors.

4 Likes

I have a standard installation that I performed from the website. Inside the container the /var does not contain a ./discourse. It does contain a ./www though. The /var/www/discourse does exist. Everything inside of it is owned by discourse and there is no shared or standalone folder.

There is a /var/discourse/shared/standalone folder outside of the container. Being a docker installation, there is no docker outside the container.

1 Like

^^ anything visible in the error logs?

I have no /logs. There is a /var/discourse/shared/standalone/log/var-log folder and there is a /var/log folder. Both of these folders contain lots of .gz files.

When logged in as an administrator, you should be able to visit https://{your forum}}/logs in a browser

Thank you! I was not aware. I just triggered the 500 error editing a post and looked at the log:


The error is triggered the very second I click save.

Can you copy/paste the whole of the ‘info’ tab and the ‘backtrace’ tab? (the most useful part of the backtrace is the top, which is cut off in that screenshot)

Here’s the info tab right after I trigger the 500 error by editing any existing post.

Hi @vmsman :slightly_smiling_face: How are you getting on?

If you can, could you copy and paste the full ‘info’ and ‘backtrace’ as a codeblock here on Meta so we can see all the important bits?

Here’s a different error from my test site as an example:

Message (35 copies reported)

Failed to warm up pretty text: JavaScript was terminated (either by timeout or explicitly)

Backtrace

lib/discourse.rb:772:in `rescue in after_fork'
lib/discourse.rb:768:in `after_fork'
/var/www/discourse/lib/demon/base.rb:217:in `establish_app'
/var/www/discourse/lib/demon/base.rb:147:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:10:in `block in fork'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:8:in `fork'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:8:in `fork'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:27:in `fork'
/var/www/discourse/lib/demon/base.rb:144:in `run'
/var/www/discourse/lib/demon/base.rb:140:in `start'

I found something significant. When I edit an existing post I see a message in red indicating that drafts are offline.

Hopefully this is what you need. The 500 error appears to generate a #<Net::OpenTimeout: execution expired>

/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `initialize'
/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `open'
/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `block in connect'
/usr/local/lib/ruby/2.7.0/timeout.rb:105:in `timeout'
/usr/local/lib/ruby/2.7.0/net/http.rb:958:in `connect'
/usr/local/lib/ruby/2.7.0/net/http.rb:943:in `do_start'
/usr/local/lib/ruby/2.7.0/net/http.rb:932:in `start'
/usr/local/lib/ruby/2.7.0/net/http.rb:606:in `start'
/var/www/discourse/lib/final_destination.rb:515:in `safe_session'
/var/www/discourse/lib/final_destination.rb:455:in `safe_get'
/var/www/discourse/lib/final_destination.rb:147:in `get'
/var/www/discourse/lib/retrieve_title.rb:63:in `fetch_title'
/var/www/discourse/lib/retrieve_title.rb:7:in `crawl'
/var/www/discourse/app/jobs/regular/crawl_topic_link.rb:39:in `execute'
/var/www/discourse/app/jobs/base.rb:232:in `block (2 levels) in perform'
rails_multisite-4.0.1/lib/rails_multisite/connection_management.rb:80:in `with_connection'
/var/www/discourse/app/jobs/base.rb:221:in `block in perform'
/var/www/discourse/app/jobs/base.rb:217:in `each'
/var/www/discourse/app/jobs/base.rb:217:in `perform'
sidekiq-6.4.1/lib/sidekiq/processor.rb:196:in `execute_job'
sidekiq-6.4.1/lib/sidekiq/processor.rb:164:in `block (2 levels) in process'
sidekiq-6.4.1/lib/sidekiq/middleware/chain.rb:138:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:138:in `call'
sidekiq-6.4.1/lib/sidekiq/middleware/chain.rb:140:in `block in invoke'
sidekiq-6.4.1/lib/sidekiq/middleware/chain.rb:143:in `invoke'
sidekiq-6.4.1/lib/sidekiq/processor.rb:163:in `block in process'
sidekiq-6.4.1/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_retry.rb:114:in `local'
sidekiq-6.4.1/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq.rb:40:in `block in <module:Sidekiq>'
sidekiq-6.4.1/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/processor.rb:257:in `stats'
sidekiq-6.4.1/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_logger.rb:13:in `call'
sidekiq-6.4.1/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_retry.rb:81:in `global'
sidekiq-6.4.1/lib/sidekiq/processor.rb:124:in `block in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_logger.rb:39:in `prepare'
sidekiq-6.4.1/lib/sidekiq/processor.rb:123:in `dispatch'
sidekiq-6.4.1/lib/sidekiq/processor.rb:162:in `process'
sidekiq-6.4.1/lib/sidekiq/processor.rb:78:in `process_one'
sidekiq-6.4.1/lib/sidekiq/processor.rb:68:in `run'
sidekiq-6.4.1/lib/sidekiq/util.rb:56:in `watchdog'
sidekiq-6.4.1/lib/sidekiq/util.rb:65:in `block in safe_thread'

I am also seeing a ActionView::Template::Error (undefined method `stylesheet_path’ for #Stylesheet::Manager::Builder:0x00007f27b6c2f850 Did you mean? stylesheet_relpath stylesheet_fullpath) lib/stylesh

lib/stylesheet/manager.rb:246:in `block in stylesheet_details'
lib/stylesheet/manager.rb:215:in `synchronize'
lib/stylesheet/manager.rb:215:in `stylesheet_details'
lib/stylesheet/manager.rb:192:in `stylesheet_link_tag'
app/helpers/application_helper.rb:565:in `discourse_stylesheet_link_tag'
app/views/layouts/crawler.html.erb:11
actionview (6.1.4.1) lib/action_view/base.rb:247:in `public_send'
actionview (6.1.4.1) lib/action_view/base.rb:247:in `_run'
actionview (6.1.4.1) lib/action_view/template.rb:154:in `block in render'
activesupport (6.1.4.1) lib/active_support/notifications.rb:205:in `instrument'
actionview (6.1.4.1) lib/action_view/template.rb:345:in `instrument_render_template'
actionview (6.1.4.1) lib/action_view/template.rb:152:in `render'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:72:in `block in render_with_layout'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `instrument'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:55:in `render_template'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:11:in `render'
actionview (6.1.4.1) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
actionview (6.1.4.1) lib/action_view/renderer/renderer.rb:29:in `render_to_object'
actionview (6.1.4.1) lib/action_view/rendering.rb:117:in `block in _render_template'
actionview (6.1.4.1) lib/action_view/base.rb:273:in `in_rendering_context'
actionview (6.1.4.1) lib/action_view/rendering.rb:116:in `_render_template'
actionpack (6.1.4.1) lib/action_controller/metal/streaming.rb:218:in `_render_template'
actionview (6.1.4.1) lib/action_view/rendering.rb:103:in `render_to_body'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (6.1.4.1) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (6.1.4.1) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
activesupport (6.1.4.1) lib/active_support/core_ext/benchmark.rb:14:in `ms'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:46:in `block in render'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
activerecord (6.1.4.1) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:45:in `render'
lib/topic_list_responder.rb:13:in `block (2 levels) in respond_with_list'
actionpack (6.1.4.1) 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:103:in `block (2 levels) in <class:ListController>'
actionpack (6.1.4.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
i18n (1.9.1) lib/i18n.rb:328:in `with_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.4.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.4.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack (6.1.4.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.4.1) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (6.1.4.1) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:842:in `call'
lib/middleware/omniauth_bypass_middleware.rb:71: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'
actionpack (6.1.4.1) lib/action_dispatch/http/permissions_policy.rb:22: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.1.4.1) lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster (2.10.1) lib/logster/middleware/reporter.rb:43:in `call'
railties (6.1.4.1) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.4.1) 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.1.4.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/host_authorization.rb:92:in `call'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiler.rb:249:in `call'
message_bus (4.0.0) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:198:in `call'
railties (6.1.4.1) lib/rails/engine.rb:539:in `call'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `public_send'
railties (6.1.4.1) lib/rails/railtie.rb:207: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 (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing'

It turns out that I did not notice, but apparently I can’t upload any images now. Any attempt to upload an image on a new post results in “Sorry, there was an error uploading the file. Please try again.”. So, apparently I cannot edit and save anything in an old post without a 500 error and I can’t create a new post if it is not text only. So, I can both create and delete a text only post. So I think we have narrowed down the problem to some type of error with any post with graphics both new and old. I am the admin user in these tests.

So, it total frustration, I decided to try a rebuild. The first errors I see are:

I, [2022-04-29T00:19:51.497560 #1]  INFO -- : > cd /var/www/discourse && [ ! -d 'node_modules' ] || su discourse -c 'yarn install --production && yarn cache clean'
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".
warning Cannot find a suitable global folder. Tried these: "/usr/local, /home/discourse/.yarn"
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".

Those are interesting errors because I 777’ed the /home/discourse and I still get these errors.
No other errors until the end:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 716 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
451d4b5ee8d036df6ab8f7717019d94b66d10d261c3d1201547dad7a1722a544
==================== END REBUILD LOG ====================
Failed to rebuild app.

Anyway, after running ./discourse-doctor I was able to post with graphics and edit posts with graphics again until I rebooted and now I have the same errors back.

I think maybe we should look at this from the basics:

  • Is this a standard install?
  • Do you have any plugins or custom themes installed?
  • When you rebuild, what are the errors in the output (ie. at the end, when it asks you to scroll up for more specific errors, what errors do you see/can you copy the whole thing into a codeblock here so we can see)
  • What changes did discourse-doctor make/suggest, and what did you do to ‘reboot’ your instance that made those changes stop working?

This is a standard install. It’s been around for about 2 years.
I use no plugins or custom themes.
I pasted all of the errors I am getting during the rebuild.
The absolute first errors are:

I, [2022-04-29T00:19:51.497560 #1]  INFO -- : > cd /var/www/discourse && [ ! -d 'node_modules' ] || su discourse -c 'yarn install --production && yarn cache clean'
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".
warning Cannot find a suitable global folder. Tried these: "/usr/local, /home/discourse/.yarn"
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".

Discourse-doctor suggests no changes and appears to run just fine.

I don’t know exactly when the 500 errors started which is the same time that I am unable to save drafts or posts with graphics. Go visit my forum at: https://discussion.scottibyte.com to see it first hand. IN the posts above, I put absolutely EVERY error I saw during the rebuild and the discourse-doctor.

I can tell you that after I run:

./discourse-setup rebuild

That the instance fails to start as you can see above. If I run:

./discourse-doctor

Immediately after it finishes the instance is somehow at least started, but I have the same errors.
I like this product, but it seems so riddled with random errors every couple months that are difficult to fix. My installation is absolutely standard with no modifications and it just breaks randomly.

1 Like

Is your disk full? I think you’d get a warning, though.

I’ll be back online properly later, but just to quickly check, is that a typo?

The command should be:

./launcher rebuild app

No, it’s not a typo. I am using the wrong command apparently. I am trying it right now.