epistolE
tRPCโ€ข3y agoโ€ข
2 replies
epistol

Why transformer: superjson breaks the POST ?

With all the GET request I do there seem to be no error, but as soon as I try sending a POST request, i get the following :

 "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"object\",\n    \"received\": \"undefined\",\n    \"path\": [],\n    \"message\": \"Required\"\n  }\n]",
            "code": -32600,
            "data": {
                "code": "BAD_REQUEST",
                "httpStatus": 400,


Rocking the https://github.com/trpc/trpc/tree/main/examples/fastify-server with a simple :

create: publicProcedure
    .input(z.object({ title: z.string() }))
    .mutation(({ input, ctx }) => {
      const id = db.posts.length + 1;
      const post = { id, ...input };
      db.posts.push(post);
      return post;
    }),
GitHub
๐Ÿง™โ€โ™€๏ธ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
trpc/examples/fastify-server at main ยท trpc/trpc
Was this page helpful?