Issue with `RpcSerialization.layerJson` Returning Unexpected Byte Array Instead of JSON

I'm trying to debug a problem I have with the RpcSerialization.layerJson (I don't know if it is relevant as I find the problem loggin the defect in the encode returned from unsafeMake used to create the serialization layer; i suppose it's the same with ndjson).

I make a repro here: https://codesandbox.io/p/devbox/xr28s8

Making a request (to https://xr28s8-3000.csb.app) with an empty id in the payload, returns something like:
[{"0":123,"1":34,"2":95,"3":116,"4":97,"5":103,"6":34,"7":58,"8":34,"9":68,"10":101,"11":102,"12":101,"13":99,"14":116,"15":34,"16":44,"17":34,"18":100,"19":101,"20":102,"21":101,"22":99,"23":116,"24":34,"25":58,"26":123,"27":34,"28":110,"29":97,"30":109,"31":101,"32":34,"33":58,"34":34,"35":83,"36":121,"37":110,"38":116,"39":97,"40":120,"41":69,"42":114,"43":114,"44":111,"45":114,"46":34,"47":44,"48":34,"49":109,"50":101,"51":115,"52":115,"53":97,"54":103,"55":101,"56":34,"57":58,"58":34,"59":69,"60":120,"61":112,"62":101,"63":99,"64":116,"65":101,"66":100,"67":32,"68":39,"69":44,"70":39,"71":32,"72":111,"73":114,"74":32,"75":39,"76":125,"77":39,"78":32,"79":97,"80":102,"81":116,"82":101,"83":114,"84":32,"85":112,"86":114,"87":111,"88":112,"89":101,"90":114,"91":116,"92":121,"93":32,"94":118,"95":97,"96":108,"97":117,"98":101,"99":32,"100":105,"101":110,"102":32,"103":74,"104":83,"105":79,"106":78,"107":32,"108":97,"109":116,"110":32,"111":112,"112":111,"113":115,"114":105,"115":116,"116":105,"117":111,"118":110,"119":32,"120":49,"121":52,"122":53,"123":32,"124":40,"125":108,"126":105,"127":110,"128":101,"129":32,"130":55,"131":32,"132":99,"133":111,"134":108,"135":117,"136":109,"137":110,"138":32,"139":53,"140":41,"141":34,"142":125,"143":125}]

when it fails with a Defect, instead of returning the expected payload:
{
  _tag: 'Defect',
  defect: {
    name: 'TypeError',
    message: 'Cannot convert undefined to a BigInt'
  }
}
Was this page helpful?