Error with RPC Request

I have this simple rpc router:

class Greet extends Schema.TaggedRequest<Greet>()('Greet', {
    failure: Schema.Never,
    success: Schema.String,
    payload: {
        name: Schema.String
    }
}) {
}

export const appRouter = RpcRouter.make(
    Rpc.effect(Greet, ({ name }) => Effect.succeed(`Hello, ${name}!`))
);


and I reach it with this curl request:

curl -X POST http://localhost:3000/api/rpc \
     -H "Content-Type: application/json" \
     -d '[
           {
             "request": {
               "_tag": "Greet",
               "payload": {
                 "name": "Alice"
               }
             },
             "traceId": "trace-123",
             "spanId": "span-123",
             "sampled": true,
             "headers": {}
           }
         ]'


Which gives me this error that I can't get rid of:

⨯ (FiberFailure) ParseError: ReadonlyArray<{ readonly request: ((Greet (Encoded side) <-> Greet) <-> readonly [Greet, any]); readonly traceId: string; readonly spanId: string; readonly sampled: boolean; readonly headers: { readonly [x: string]: string } }>
[0]
  └─ { readonly request: ((Greet (Encoded side) <-> Greet) <-> readonly [Greet, any]); readonly traceId: string; readonly spanId: string; readonly sampled: boolean; readonly headers: { readonly [x: string]: string } }
     └─ ["request"]
        └─ ((Greet (Encoded side) <-> Greet) <-> readonly [Greet, any])
           └─ Encoded side transformation failure
              └─ (Greet (Encoded side) <-> Greet)
                 └─ Encoded side transformation failure
                    └─ Greet (Encoded side)
                       └─ ["name"]
                          └─ is missing
POST /api/rpc 500 in 2023ms


Any ideas?
Was this page helpful?