Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Plausible outages #2996

Closed
obulat opened this issue Sep 6, 2023 · 0 comments · Fixed by #4099
Closed

Handle Plausible outages #2996

obulat opened this issue Sep 6, 2023 · 0 comments · Fixed by #4099
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend

Comments

@obulat
Copy link
Contributor

obulat commented Sep 6, 2023

Problem

When Plausible server was out on August 28th, we received reports of many 5xx responses from Nuxt. This was misleading because there was no degradation of Openverse frontend for the user (the analytics requests are not blocking and don't break anything in the UI if they fail).

Description

We should re-write the response header in case Plausible returns 503. Here's is the example of rewriting for 504 errors:

// Prevent 504 errors in the browser console.
onError: (err, _req, res) => {
if (!isProdNotPlaywright && err.message.includes("ECONNREFUSED")) {
res.writeHead(200, { "Content-Type": "text/plain" })
res.end("plausible not running")
}
},
} satisfies ProxyOptions,

In case the error message contains "service unavailable", we should add the error message to the message that is logged to the console. I think we don't event need to check if it's prod or dev environment, as we might want to see the message logged everywhere.

if (err.message.toLowerCase().includes("service unavailable")) { 
       res.writeHead(424, { "Content-Type": "text/plain" }) 
       res.end(`Plausible unavailable: ${e.message}`) 
     } 

Note: I am not sure about the shape of the err object here. In Cloudflare, I can only see the "Edge status code" and "Origin status code", both equal to "503 Service Unavailable"

@obulat obulat added 🟨 priority: medium Not blocking but should be addressed soon 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🧱 stack: frontend Related to the Nuxt frontend labels Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant