tRPCttRPC
Powered by
AlexA
tRPC•3y ago•
7 replies
Alex

Running TRPC on Vercel with custom serialization fails

Hi all,
I'm having some difficulties with the serialization of my objects when I run on vercel.
I'm running nextjs 13.4.4 with trpc/server,client,next 10.28.1 and the next page routing.
I'm using a custom type "ts-money" which is returned in a trpc response like:
getSalaryEnvironment: protectedProcedure
    .input(
      z.object({
        administratorId: z.string(),
        salaryDate: salaryDateSchema,
      }),
    )
    .query(async ({ input }) => {
      return {
        date: new Date(2023, 5, 31),
        nbrOfDaysWorked: 20,
        salaryDate: input.salaryDate,
        totalGrossIncomeFromPreviousSalaryInYear: new Money(6000000,Currencies.EUR),
      }
    }),
getSalaryEnvironment: protectedProcedure
    .input(
      z.object({
        administratorId: z.string(),
        salaryDate: salaryDateSchema,
      }),
    )
    .query(async ({ input }) => {
      return {
        date: new Date(2023, 5, 31),
        nbrOfDaysWorked: 20,
        salaryDate: input.salaryDate,
        totalGrossIncomeFromPreviousSalaryInYear: new Money(6000000,Currencies.EUR),
      }
    }),
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

ECONNREFUSED with TRPC call on Vercel
xdxd#5555 / hanyaXxdxd#5555 / hanya / ❓-help
3y ago
Fastify + TRPC on Vercel
brumbrum_brumBbrumbrum_brum / ❓-help
2y ago
Vercel maxDuration with tRPC
VengeanceVVengeance / ❓-help
3y ago
Clarification on inconsistency between React Query + tRPC docs with serialization
lukeLluke / ❓-help
2y ago