MuckRock / documentcloud-frontend

DocumentCloud's front end source code - Please report bugs, issues and feature requests to info@documentcloud.org
https://www.documentcloud.org
GNU Affero General Public License v3.0
15 stars 5 forks source link

500 error when viewing document page anonymously #569

Closed allanlasser closed 3 weeks ago

allanlasser commented 3 weeks ago

I've hit this a few times following links to the staging server. While signed out, document routes (/document/[id]-[slug]) report 500 errors.

When viewing a document without permission, it should return a 404 page that includes a link back to the manager and a button to sign in.

eyeseast commented 3 weeks ago

Can you post a URL where you're hitting this? There's something weird happening with staging that is causing an uptick in 500s.

allanlasser commented 3 weeks ago

Ah interesting. I was hitting it on https://deploy-preview-568.muckcloud.com/documents/20006371-smallsville/, but that's no longer the case.

For other routes on that preview branch, I'm getting the expected 404 response.

allanlasser commented 3 weeks ago

I can close this issue, the 500 must be from something else!

eyeseast commented 3 weeks ago

Yeah, it was an issue with PDF.js using Promise.withResolvers, which is available in browsers but not in Node until 22, which it turns out we can't even get on yet. I'm not sure why it was being called server-side at all, but I added a polyfill, so that fixed this issue.