Effect CommunityEC
Effect Community10mo ago
27 replies
imagio

Issues with Date Handling in RPC Calls and Error Reporting

I'm having some trouble with Dates and rpc. When I try to call my endpoint with a request that includes a Schema.DateFromSelf (or any other date type like Model.DateTimeFromDate) I run into two problems:

1. The RPC call fails but any useful details are not returned in the Cause. Instead the cause is just a string "[object Object]"
2. The actual failure response is visible in the network inspector and is {"_tag":"Exit","requestId":"1","exit":{"_tag":"Failure","cause":{"_tag":"Die","defect":[{"_tag":"Type","path":["actions",0,"created_at"],"message":"Expected DateFromSelf, actual \"2025-04-05T20:32:04.955Z\""}]}}}

Here's a playground illustrating the issue: https://effect.website/play#5d5a6bc6e747

@Tim Smart any ideas about this? Are dates expected to work with Rpc or am I doing something wrong?

(another minor issue -- you can't use Model.Class in the playground because it fails type check internally and won't compile)
Was this page helpful?