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
The conversation revolves around an error encountered in an RPC handler from the Effect Typescript library. The error message states: "handler must return an array of responses with the same length as the requests".
Issue Understanding: The error appears when there is a mismatch between the number of requests sent and the number of responses received. This happens in batched requests where the client expects a response for each request.
Potential Causes: One user identified an issue when doing custom encoding server-side using msw. Another pointed out that the error might occur if the RPC schema is incorrect, specifically if an undefined error is thrown.
Resolution Attempts: Users suggest checking the schema and ensuring it aligns with the RPC definitions. Also, custom implementations or encoding might need review.
Key Takeaways:
Ensure request and response arrays match in length during batched RPC calls.
Check the RPC schema for mismatches or missing error definitions.
Consider reviewing any custom server-side handling or encoding if discrepancies occur.
Improved error messages could be beneficial, and a community member proposed contributing a PR for better error handling.
If your rpc handler fails with an error that is not defined in your rpc schema you get a very unhelpful error on the client: RuntimeException: @effect/rpc: handler must return an array of responses with the same length as the requests.. I'll see if I can make a PR to improve error handling in this case.
Summary
The conversation revolves around an error encountered in an RPC handler from the Effect Typescript library. The error message states: "handler must return an array of responses with the same length as the requests".
Issue Understanding: The error appears when there is a mismatch between the number of requests sent and the number of responses received. This happens in batched requests where the client expects a response for each request.
Potential Causes: One user identified an issue when doing custom encoding server-side using
msw
. Another pointed out that the error might occur if the RPC schema is incorrect, specifically if an undefined error is thrown.Resolution Attempts: Users suggest checking the schema and ensuring it aligns with the RPC definitions. Also, custom implementations or encoding might need review.
Key Takeaways:
Discord thread
https://discord.com/channels/795981131316985866/1296767660490625034
The text was updated successfully, but these errors were encountered: