bluesky-social / atproto

Social networking technology created by Bluesky
Other
6.14k stars 431 forks source link

PDS gives internal error rather than 404 when hitting unknown route #273

Closed devinivy closed 1 year ago

devinivy commented 1 year ago

When hitting a route on the PDS outside of /xrpc/* (e.g. curl http://localhost:3000/x), the server serves a 500 due to a runtime TypeError. Instead, I would expect to see a 404. Here's that TypeError:

TypeError: res.status is not a function
    at handler2 (/atproto/packages/pds/dist/index.js:96487:7)
    at newFn2 (/atproto/packages/pds/dist/index.js:68772:20)
    at Layer2.handle [as handle_request] (/atproto/packages/pds/dist/index.js:574:9)
    at trim_prefix (/atproto/packages/pds/dist/index.js:1416:17)
    at /atproto/packages/pds/dist/index.js:1389:13
    at Function.process_params (/atproto/packages/pds/dist/index.js:1424:16)
    at next (/atproto/packages/pds/dist/index.js:1383:15)
    at /atproto/packages/pds/dist/index.js:1602:19
    at next (/atproto/packages/pds/dist/index.js:1376:18)
    at Function.handle (/atproto/packages/pds/dist/index.js:1319:7)

A secondary thing here— it may be nice to get sourcemaps going so that these errors are a little easier to track down. Happy to peel that off into a separate issue if it sounds like it might be desirable.

dholms commented 1 year ago

+1 on source maps