
discord-questions.trpc.io/m/1214896287913345115
Preview meta tags from the discord-questions.trpc.io website.
Linked Hostnames
5- 5 links todiscord-questions.trpc.io
- 1 link todiscord.com
- 1 link todiscord.gg
- 1 link totrpc.io
- 1 link towww.answeroverflow.com
Thumbnail
Search Engine Appearance
Why deprecate experimental_standaloneMiddleware? - tRPC
I am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly? The example shows we can use a plugin. This would take in a new procedure to do concating of procedures. But this is not exactly what I want. In my code I have this: ```ts const todoAppInstalledMiddleware experimental_standaloneMiddleware<{ ctx: TProtectedProcedureContext; }>().create(async ({ ctx, next }) => { const foundPermission = await ctx.prisma.teamAppRole.findFirst({ where: { AppPermissions: { some: { id: "234234324-my-todo-app-id-here-yay", }, }, Team: { id: ctx.session.user.activeTeamId, }, Users: { some: { id: ctx.session.user.id, }, }, }, select: { id: true }, }); if (!foundPermission) throw new TRPCError({ code: "UNAUTHORIZED", message: `You don't have permission to do this. Contact an administrator if you believe it is an error.`, }); return next({ ctx }); }); ``` Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
Bing
Why deprecate experimental_standaloneMiddleware? - tRPC
I am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly? The example shows we can use a plugin. This would take in a new procedure to do concating of procedures. But this is not exactly what I want. In my code I have this: ```ts const todoAppInstalledMiddleware experimental_standaloneMiddleware<{ ctx: TProtectedProcedureContext; }>().create(async ({ ctx, next }) => { const foundPermission = await ctx.prisma.teamAppRole.findFirst({ where: { AppPermissions: { some: { id: "234234324-my-todo-app-id-here-yay", }, }, Team: { id: ctx.session.user.activeTeamId, }, Users: { some: { id: ctx.session.user.id, }, }, }, select: { id: true }, }); if (!foundPermission) throw new TRPCError({ code: "UNAUTHORIZED", message: `You don't have permission to do this. Contact an administrator if you believe it is an error.`, }); return next({ ctx }); }); ``` Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
DuckDuckGo

Why deprecate experimental_standaloneMiddleware? - tRPC
I am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly? The example shows we can use a plugin. This would take in a new procedure to do concating of procedures. But this is not exactly what I want. In my code I have this: ```ts const todoAppInstalledMiddleware experimental_standaloneMiddleware<{ ctx: TProtectedProcedureContext; }>().create(async ({ ctx, next }) => { const foundPermission = await ctx.prisma.teamAppRole.findFirst({ where: { AppPermissions: { some: { id: "234234324-my-todo-app-id-here-yay", }, }, Team: { id: ctx.session.user.activeTeamId, }, Users: { some: { id: ctx.session.user.id, }, }, }, select: { id: true }, }); if (!foundPermission) throw new TRPCError({ code: "UNAUTHORIZED", message: `You don't have permission to do this. Contact an administrator if you believe it is an error.`, }); return next({ ctx }); }); ``` Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
General Meta Tags
6- titleWhy deprecate experimental_standaloneMiddleware? - tRPC
- charsetutf-8
- viewportwidth=device-width, initial-scale=1
- next-size-adjust
- descriptionI am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly? The example shows we can use a plugin. This would take in a new procedure to do concating of procedures. But this is not exactly what I want. In my code I have this: ```ts const todoAppInstalledMiddleware experimental_standaloneMiddleware<{ ctx: TProtectedProcedureContext; }>().create(async ({ ctx, next }) => { const foundPermission = await ctx.prisma.teamAppRole.findFirst({ where: { AppPermissions: { some: { id: "234234324-my-todo-app-id-here-yay", }, }, Team: { id: ctx.session.user.activeTeamId, }, Users: { some: { id: ctx.session.user.id, }, }, }, select: { id: true }, }); if (!foundPermission) throw new TRPCError({ code: "UNAUTHORIZED", message: `You don't have permission to do this. Contact an administrator if you believe it is an error.`, }); return next({ ctx }); }); ``` Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
Open Graph Meta Tags
3- og:titleWhy deprecate experimental_standaloneMiddleware? - tRPC
- og:descriptionI am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly? The example shows we can use a plugin. This would take in a new procedure to do concating of procedures. But this is not exactly what I want. In my code I have this: ```ts const todoAppInstalledMiddleware experimental_standaloneMiddleware<{ ctx: TProtectedProcedureContext; }>().create(async ({ ctx, next }) => { const foundPermission = await ctx.prisma.teamAppRole.findFirst({ where: { AppPermissions: { some: { id: "234234324-my-todo-app-id-here-yay", }, }, Team: { id: ctx.session.user.activeTeamId, }, Users: { some: { id: ctx.session.user.id, }, }, }, select: { id: true }, }); if (!foundPermission) throw new TRPCError({ code: "UNAUTHORIZED", message: `You don't have permission to do this. Contact an administrator if you believe it is an error.`, }); return next({ ctx }); }); ``` Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
- og:imagehttps://discord-questions.trpc.io/og/post?id=1214896287913345115
Twitter Meta Tags
4- twitter:cardsummary_large_image
- twitter:titleWhy deprecate experimental_standaloneMiddleware? - tRPC
- twitter:descriptionI am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly? The example shows we can use a plugin. This would take in a new procedure to do concating of procedures. But this is not exactly what I want. In my code I have this: ```ts const todoAppInstalledMiddleware experimental_standaloneMiddleware<{ ctx: TProtectedProcedureContext; }>().create(async ({ ctx, next }) => { const foundPermission = await ctx.prisma.teamAppRole.findFirst({ where: { AppPermissions: { some: { id: "234234324-my-todo-app-id-here-yay", }, }, Team: { id: ctx.session.user.activeTeamId, }, Users: { some: { id: ctx.session.user.id, }, }, }, select: { id: true }, }); if (!foundPermission) throw new TRPCError({ code: "UNAUTHORIZED", message: `You don't have permission to do this. Contact an administrator if you believe it is an error.`, }); return next({ ctx }); }); ``` Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
- twitter:imagehttps://discord-questions.trpc.io/og/post?id=1214896287913345115
Link Tags
9- canonicalhttps://discord-questions.trpc.io/m/1214896287913345115
- iconhttps://cdn.answeroverflow.com/867764511159091230/6af104c7f0f39a12fcd55bd7bd28928f/icon.png
- preloadhttps://www.answeroverflow.com/_next/static/media/4f05ba3a6752a328-s.p.woff2
- preloadhttps://www.answeroverflow.com/_next/static/media/9cf9c6e84ed13b5e-s.p.woff2
- preload/discord/3.png
Links
9- https://discord-questions.trpc.io
- https://discord-questions.trpc.io/search
- https://discord-questions.trpc.io/u/156512494922235904
- https://discord-questions.trpc.io/u/208752229815943170
- https://discord-questions.trpc.io/u/704377334647619626