You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the previous example, an error in the body stream can either result in the handler's payload being sent ({ error: 'some message' }) OR result in Express' finalhandler sending a generir error response. Whichever occurs first depends on the order of async tasks which is not predictable by the user of xrpc-server.
IMHO xrpc-server should avoid this behavior and require that the handler handles any potential error when the body is a stream. For convenience, RouteOpts could be used in order to describe how the payload should be processed (e.g. allow defining acceptable content types).
The text was updated successfully, but these errors were encountered:
The following lines in
xrpc-server
can cause an undefined behavior:atproto/packages/xrpc-server/src/server.ts
Lines 240 to 243 in 30b05a7
The reason is that the
next()
function might get called multiple times. These lines also prevent the handler to catch and handle the error itself:In the previous example, an error in the
body
stream can either result in the handler's payload being sent ({ error: 'some message' }
) OR result in Express'finalhandler
sending a generir error response. Whichever occurs first depends on the order of async tasks which is not predictable by the user ofxrpc-server
.IMHO
xrpc-server
should avoid this behavior and require that the handler handles any potential error when the body is a stream. For convenience,RouteOpts
could be used in order to describe how the payload should be processed (e.g. allow defining acceptable content types).The text was updated successfully, but these errors were encountered: