This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 162
Unknown Procedure Type - Next.js App Router #431
Comments
PotatoHD404
referenced
this issue
in PotatoHD404/trpc-openapi
Jan 15, 2024
Facing the same issue. Any update on this? |
see fix |
Forked and Added support for Next.js 14. |
@jlalmes / @alex-streza, i faced the same issue when i'm trying to use this via nest application. the issue lies in
currently this is the method implementation: const getProcedureType = (procedure: OpenApiProcedure): ProcedureType => {
if (procedure._def.query) return 'query';
if (procedure._def.mutation) return 'mutation';
if (procedure._def.subscription) return 'subscription';
throw new Error('Unknown procedure type');
}; changing this to below: const getProcedureType = (procedure: OpenApiProcedure): ProcedureType => {
if (procedure._def.query) return 'query';
if (procedure._def.mutation) return 'mutation';
if (procedure._def.subscription) return 'subscription';
if (procedure._def.type) return procedure._def.type; // return type if it exists on _def without breaking existing functionality
throw new Error('Unknown procedure type');
}; may solve this issue. This is the basic stackblitz app to reproduce this. PS: i'm using @trpc/server@next version. |
Any solutions? facing the same |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm running a project using create-t3-turbo and wanted to add OpenAPI support to trpc routers but I keep getting this error, any help is much appreciated, kinda counting on getting OpenAPI support this way.
I went in the procedure.js file to debug and saw that
procedure._def
doesn't seem to exist in my trpc: next version (11.0.0-next-alpha.149+11361b82d)I'm not 100% certain if it's because of this but I'm also using trpc in app router and trpc-openapi in pages/api
pages/api/[...trpc].ts
trpc.ts
The text was updated successfully, but these errors were encountered: