agadoo
agadoo
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
ty, that was my thought too, will give it a go. this is all because i've got another package that i absolutely can't do without that needs react-query ^5 (trpc 10 needs ^4 i believe)
15 replies
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
transformer is just from the shared.ts
import superjson from "superjson";
export const transformer = superjson;
import superjson from "superjson";
export const transformer = superjson;
15 replies
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
export const api = createTRPCClient<AppRouter>({
links: [
loggerLink({
enabled: (op) =>
process.env.NODE_ENV === "development" ||
(op.direction === "down" && op.result instanceof Error),
}),
// privateProcedures fail if this is uncommented
// httpBatchLink({
// transformer,
// url: getUrl(),
// }),
/**
* Custom RSC link that lets us invoke procedures without using http requests. Since Server
* Components always run on the server, we can just call the procedure as a function.
*/
() =>
({ op }) =>
observable((observer) => {
createContext()
.then((ctx) => {

return callTRPCProcedure({
procedures: appRouter._def.procedures,
path: op.path,
getRawInput: async () => await op.input,
ctx,
type: op.type,
});
})
.then((data) => {
observer.next({ result: { data } });
observer.complete();
})
.catch((cause: TRPCErrorResponse) => {
observer.error(TRPCClientError.from(cause));
});
}),
],
//@ts-expect-error this works but is deprecated
transformer,
});
export const api = createTRPCClient<AppRouter>({
links: [
loggerLink({
enabled: (op) =>
process.env.NODE_ENV === "development" ||
(op.direction === "down" && op.result instanceof Error),
}),
// privateProcedures fail if this is uncommented
// httpBatchLink({
// transformer,
// url: getUrl(),
// }),
/**
* Custom RSC link that lets us invoke procedures without using http requests. Since Server
* Components always run on the server, we can just call the procedure as a function.
*/
() =>
({ op }) =>
observable((observer) => {
createContext()
.then((ctx) => {

return callTRPCProcedure({
procedures: appRouter._def.procedures,
path: op.path,
getRawInput: async () => await op.input,
ctx,
type: op.type,
});
})
.then((data) => {
observer.next({ result: { data } });
observer.complete();
})
.catch((cause: TRPCErrorResponse) => {
observer.error(TRPCClientError.from(cause));
});
}),
],
//@ts-expect-error this works but is deprecated
transformer,
});
15 replies
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
yeah honestly am just using the default t3 setup -
15 replies
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
ok it's something to do with the cookies not being passed. if I console log out ctx.headers in the working old version i can see all the relevant stuff being passed (next-auth.csrf-token, session, user etc). moving transform to httpBatchLink it is just generic headers with no session/user/nextauth info
15 replies
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
(same for httpLink by the way)
15 replies
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 3/15/2024 in #questions
trpc v11 error: The transformer property has moved to httpLink/httpBatchLink/wsLink
I've had a similar issue - also upgraded to v11. when i leave the transformer as it is, everything works fine (i do get a TS error but can ignore it and still build/deploy); when I try moving the transformer into httpBatchLink as suggested, the public procedures work fine but the private ones don't (i get the code:'UNAUTHORISED' error; with the transformer moved into httpBatchLink, ctx.session is now null in the privateProcedure which would explain why this is happening). any ideas?
15 replies