Properly handle missing views for activities
EDIT:
The description below is of a bug that happens when an activity that isn't handled by the StatusView is encountered. This can happen if the activity is malformed / different than expected or just a wrong type.
Things we should do:
-
Don't crash in this case, but just omit the badly rendered message. Alternatively, add a catch-all that will return proper information in the status, like "could not render activity XYZ".
-
Log the error properly so we can debug it.
This kind of problem "fixes" itself after a while because the offending activities leave the TL.
After updating to d386e8a8, running a mix ecto.migrate
and then starting it with mix phx.server
, my instance keeps throwing out en error. Due to this error, the Mastodon Web UI is not working, nor are any Mastodon apps on my phone:
08:43:08.161 [error] #PID<0.1059.0> running Pleroma.Web.Endpoint (cowboy_protocol) terminated
Server: weeaboo.space:80 (http)
Request: GET /api/v1/timelines/home
** (exit) an exception was raised:
** (Phoenix.Template.UndefinedError) Could not render "status.json" for Pleroma.Web.MastodonAPI.StatusView, please define a matching clause for render/2 or define a template at "lib/pleroma/web/templates/mastodon_api/status". No templates were compiled for this module.
(This error is truncated, the actual error follows with Assigns:
and then a long JSON stream of URLs to ActivityPub stuff which changes each time. I'm guessing it's the timeline contents that it's trying to render.)
I can confirm that the file lib/pleroma/web/templates/mastodon_api/status
does not exist on my server like the error suggests. Though it also isn't present in this repo, so I'm not sure if it's something that's supposed to be generated automatically.
The Mastodon UI just keeps spitting out "500 Internal Server Error" indefinitely and shows a blank home timeline. The above error reappears every time it spits out such an error:
Troubleshooting steps tried:
mix deps.get
-
mix clean
andmix compile
- Updating system packages
Neither fixed the issue.