ActionDispatch::Http::MimeNegotiation::InvalidType error

Hello,

I’ve got some error in /logs. I am on e3144fc0c7 now.

One of the error from /logs :arrow_down:

Info
ActionDispatch::Http::MimeNegotiation::InvalidType ("image/avif; image/webp; image/apng; image/svg+xml; image/*; */*" is not a valid MIME type)
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:353:in `call'
config/initializers/008-rack-cors.rb:25:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:177:in `call'
Backtrace
actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:55:in `rescue in block in accepts'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:46:in `block in accepts'

rack (2.2.3) lib/rack/request.rb:69:in `fetch'

rack (2.2.3) lib/rack/request.rb:69:in `fetch_header'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:45:in `accepts'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:74:in `block in formats'

rack (2.2.3) lib/rack/request.rb:69:in `fetch'

rack (2.2.3) lib/rack/request.rb:69:in `fetch_header'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:70:in `formats'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:66:in `format'

actionpack (6.1.3.2) lib/action_controller/metal/instrumentation.rb:26:in `process_action'

actionpack (6.1.3.2) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'

activerecord (6.1.3.2) lib/active_record/railties/controller_runtime.rb:27:in `process_action'

actionpack (6.1.3.2) lib/abstract_controller/base.rb:165:in `process'

actionview (6.1.3.2) lib/action_view/rendering.rb:39:in `process'

rack-mini-profiler (2.3.2) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'

actionpack (6.1.3.2) lib/action_controller/metal.rb:190:in `dispatch'

actionpack (6.1.3.2) lib/action_controller/metal.rb:254:in `dispatch'

actionpack (6.1.3.2) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'

actionpack (6.1.3.2) lib/action_dispatch/routing/route_set.rb:33:in `serve'

actionpack (6.1.3.2) lib/action_dispatch/journey/router.rb:50:in `block in serve'

actionpack (6.1.3.2) lib/action_dispatch/journey/router.rb:32:in `each'

actionpack (6.1.3.2) lib/action_dispatch/journey/router.rb:32:in `serve'

actionpack (6.1.3.2) 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.3.2) lib/action_dispatch/http/permissions_policy.rb:22:in `call'

lib/content_security_policy/middleware.rb:12:in `call'

lib/middleware/anonymous_cache.rb:353:in `call'

config/initializers/008-rack-cors.rb:25: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.3.2) lib/action_dispatch/middleware/cookies.rb:689:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'

activesupport (6.1.3.2) lib/active_support/callbacks.rb:98:in `run_callbacks'

actionpack (6.1.3.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'

logster (2.9.7) lib/logster/middleware/reporter.rb:43:in `call'

config/initializers/100-silence_logger.rb:29:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'

actionpack (6.1.3.2) 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.3.2) lib/action_dispatch/middleware/executor.rb:14:in `call'

rack (2.2.3) lib/rack/sendfile.rb:110:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/host_authorization.rb:92:in `call'

rack-mini-profiler (2.3.2) lib/mini_profiler/profiler.rb:237:in `call'

message_bus (3.3.6) lib/message_bus/rack/middleware.rb:61:in `call'

lib/middleware/request_tracker.rb:177:in `call'

railties (6.1.3.2) lib/rails/engine.rb:539:in `call'

railties (6.1.3.2) lib/rails/railtie.rb:207:in `public_send'

railties (6.1.3.2) 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.0.0) lib/unicorn/http_server.rb:634:in `process_client'

unicorn (6.0.0) lib/unicorn/http_server.rb:732:in `worker_loop'

unicorn (6.0.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'

unicorn (6.0.0) lib/unicorn/http_server.rb:143:in `start'

unicorn (6.0.0) bin/unicorn:128:in `<top (required)>'

vendor/bundle/ruby/2.7.0/bin/unicorn:23:in `load'

vendor/bundle/ruby/2.7.0/bin/unicorn:23:in `<main>'

I did not notice any unusual on the forum but I don’t know what should I do with this. Something with CSP?

Update: User avatar is Invalid MIME type. New users avatar not loading. I think I see the other users avatar from cache.

Thank you for any response :slight_smile:

2 Likes

Now we lost our style (css) too. :confused:

ActionDispatch::Http::MimeNegotiation::InvalidType ("text/css; */*" is not a valid MIME type)
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:353:in `call'
config/initializers/008-rack-cors.rb:25: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:23:in `call'
lib/middleware/request_tracker.rb:177:in `call'
actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:55:in `rescue in block in accepts'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:46:in `block in accepts'

rack (2.2.3) lib/rack/request.rb:69:in `fetch'

rack (2.2.3) lib/rack/request.rb:69:in `fetch_header'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:45:in `accepts'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:74:in `block in formats'

rack (2.2.3) lib/rack/request.rb:69:in `fetch'

rack (2.2.3) lib/rack/request.rb:69:in `fetch_header'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:70:in `formats'

actionpack (6.1.3.2) lib/action_dispatch/http/mime_negotiation.rb:66:in `format'

actionpack (6.1.3.2) lib/action_controller/metal/instrumentation.rb:26:in `process_action'

actionpack (6.1.3.2) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'

activerecord (6.1.3.2) lib/active_record/railties/controller_runtime.rb:27:in `process_action'

actionpack (6.1.3.2) lib/abstract_controller/base.rb:165:in `process'

actionview (6.1.3.2) lib/action_view/rendering.rb:39:in `process'

rack-mini-profiler (2.3.2) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'

actionpack (6.1.3.2) lib/action_controller/metal.rb:190:in `dispatch'

actionpack (6.1.3.2) lib/action_controller/metal.rb:254:in `dispatch'

actionpack (6.1.3.2) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'

actionpack (6.1.3.2) lib/action_dispatch/routing/route_set.rb:33:in `serve'

actionpack (6.1.3.2) lib/action_dispatch/journey/router.rb:50:in `block in serve'

actionpack (6.1.3.2) lib/action_dispatch/journey/router.rb:32:in `each'

actionpack (6.1.3.2) lib/action_dispatch/journey/router.rb:32:in `serve'

actionpack (6.1.3.2) 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.3.2) lib/action_dispatch/http/permissions_policy.rb:22:in `call'

lib/content_security_policy/middleware.rb:12:in `call'

lib/middleware/anonymous_cache.rb:353:in `call'

config/initializers/008-rack-cors.rb:25: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.3.2) lib/action_dispatch/middleware/cookies.rb:689:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'

activesupport (6.1.3.2) lib/active_support/callbacks.rb:98:in `run_callbacks'

actionpack (6.1.3.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'

logster (2.9.7) lib/logster/middleware/reporter.rb:43:in `call'

railties (6.1.3.2) lib/rails/rack/logger.rb:37:in `call_app'

railties (6.1.3.2) 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.3.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'

actionpack (6.1.3.2) 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.3.2) lib/action_dispatch/middleware/executor.rb:14:in `call'

rack (2.2.3) lib/rack/sendfile.rb:110:in `call'

actionpack (6.1.3.2) lib/action_dispatch/middleware/host_authorization.rb:92:in `call'

rack-mini-profiler (2.3.2) lib/mini_profiler/profiler.rb:237:in `call'

message_bus (3.3.6) lib/message_bus/rack/middleware.rb:61:in `call'

lib/middleware/request_tracker.rb:177:in `call'

railties (6.1.3.2) lib/rails/engine.rb:539:in `call'

railties (6.1.3.2) lib/rails/railtie.rb:207:in `public_send'

railties (6.1.3.2) 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.0.0) lib/unicorn/http_server.rb:634:in `process_client'

unicorn (6.0.0) lib/unicorn/http_server.rb:732:in `worker_loop'

unicorn (6.0.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'

unicorn (6.0.0) lib/unicorn/http_server.rb:143:in `start'

unicorn (6.0.0) bin/unicorn:128:in `<top (required)>'

vendor/bundle/ruby/2.7.0/bin/unicorn:23:in `load'

vendor/bundle/ruby/2.7.0/bin/unicorn:23:in `<main>'

Finally I did a rebuild which totally broke the style so purge cache and fixed. I think the purge fixed for me this. Now just checking everything works and this topic could close. Thanks :slight_smile:

1 Like

Hello,

Today it happened again with CSS. It drops all CSS and the site was broken.

So after many days debugging I checked everything in CDN, Discourse config, S3…
Bunny CDN support said me

It does seem that these errors are generated on the origin and the CDN then pulls the broken image from there to cache.

So the problem is something with the origin server which is Vultr. I checked the server logs and os updates which is really deceptive because I always saw 0 updates when login SSH console. But I had no more idea so tried an update with apt-update and apt-get dist-upgrade.

The site is recovered immediately! :slight_smile: Since then the logs clean and runs without this error… So I think…I hope :crossed_fingers: the OS was outdated. However this is a 3 months old instance. :thinking: Now it seems to resolve the problem!

Hello,

Unfortunately the problem today happening again. :confused: @davidkingham I see you have the same (Invalid MIME type) problem on your forum with profile pictures. I know we both use Bunny CDN but if I check the origin server which is different the images still broken there too… So something happening in origin. If I change any css or rebuild app broke the site. Any idea to solve this? Thanks

Edit:
If i open one of the file.

Blank page with Invalid MIME type

If I delete the ?__ws tag from url it loads

Same thing happening on origin url.

Edit: Now it is works again…

Hello,

Yesterday I moved the site from Vultr to Upcloud which is not helped because the problem still alive. I use object storage setup… Is that possible to it cause the digitalocean S3 spaces? The profile avatars place in S3? I notice Vultr and Upcloud use microk8s is that possible to that cause this? Thank you for any response!

I’m having the same issue with avatars on my forum.

Some avatar sizes are loading for (most) users, but most sizes aren’t loading. For some users, small sizes are loading (50px and 90px), but large avatars get the mime type error And for some other users it’s the opposite.


edit: weirdly, everything seems to be working normally now…

1 Like

I just watching @davidkingham site and on his and mine site the problem appear on same time and fixing also the same time every day.

@nph7 what is your setup? Where is your server, cdn, s3 etc… plugins? I don’t know I just try to understand this situation. It is a kind of image or static file syncing issue it is also happening with css.

If I do something in this time with any css or rebuild app. The site just broke… because cannot handle the css files. Invalid MIME type.

I contacted all provider but no success. All of them said in there service is not any issue.

Same here and David site too. Now works good but every day this happening in this time and later. :confused:

1 Like

I’m using Backblaze B2 for S3, BunnyCDN and the forum is hosted on a Ubuntu DigitalOcean droplet (Toronto region).

The avatar issue was first reported by a user of my forum yesterday afternoon (~3:45PM EST), but nothing was broken anymore when I logged in to look for it at ~4:15PM.

I had performed a Discourse version upgrade to 2.8.0.beta4 two nights before and performed some custom CSS tweaks afterwards. So either of those could perhaps be a root cause.

This morning, I noticed the avatar problem at ~7:30AM and it disappeared at ~10:30 AM.

I also had a CSS issue (same “?__ws” thing you described) after I upgraded the Discourse version at ~8AM.

Reuploading the custom css theme from a local backup succesfully resolved that particular issue. (but not the avatars)

1 Like

On my setup now is UpCloud server, DigitalOcean Spaces s3 and Bunny CDN. We both use bunny but that not make sense that cause it because on the origin url happening the same Invalid MIME type error.

Maybe something happened after update I noticed first time this after changing Discourse master to main branch. But that does not explain why it happens at the same time. That is why I thinking one of our provider… not sure.

It’s impossible to offer any help without working links to sites/assets were we can reproduce the problem. Can you share a link?

1 Like