async middleware
is it possible to define an async middleware?
I want to do something like this but it throws errors when i start the server
const dbMiddleware = middleware(async ({ path, ctx, next, input }) => {
ctx.path = path;
let session: Pool | null = null;
try {
session = await getSession();
ctx.query = session.query;
let result = await next({ ctx });
if (session)
await session.end();
return result;
} catch (e: any) {
if (session)
await session.end();
}
});
MS
mark salsbery•411d ago
@Barakonda yes async works…where is the exception occurring?
B
Barakonda•410d ago
it occures when running it- the build works fine
const dbMiddleware = middleware(async ({ path, ctx, next, input }) => {
^
TypeError: (0 , createRouter_1.middleware) is not a function
nevermind... i didn't notice and i had an import loop.... i really shouldn't code in the middle of the night
4.8KMembers
View on DiscordMore Posts
The type of the second route of the nested route is neverhttps://github.com/StringKe/nx-mulit-trpc-type-error/blob/main/apps/app1/src/pages/index.tsx#L12errorFormatter ignored when using appRouter.createCallerMy errorFormatter works correctly in the actual application using an adapter, e.g.
``` trpcExpress.Is there a way to define the Websocket protocol when using wsLink()I am attempting to use tRPC with Azure's Pub/Sub Websockets service it appears to require custom proThe inferred type of this node exceeds the maximum length the compiler will serialize.Hey, there I am running into this error when I have more than 12 routers in the mergeRouters functioQuickstart not workingHello there,
There is a type error in the quickstart example if i'm not mistaken.
I pretty much coUse TRPC function inside of a TRPC functionHi all! We have a trpc query called getProduct. I want to use this getProduct query inside of anotheSupabase with trpcWhen trying to configure trpc with supabase, getting this kind of error in the console
`tRPC failed Using tRPC for uploading audio filesI want to create an api router in tRPC but am not sure if the following code is doable with tRPC. If