Skip to content

Commit

Permalink
Fixed Unknown Procedure Type - Next.js App Router
Browse files Browse the repository at this point in the history
  • Loading branch information
PotatoHD404 authored Jan 15, 2024
1 parent d1eab87 commit 51505ca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/procedure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ export const getInputOutputParsers = (procedure: OpenApiProcedure) => {
};

const getProcedureType = (procedure: OpenApiProcedure): ProcedureType => {
if (procedure._def.query) return 'query';
if (procedure._def.mutation) return 'mutation';
if (procedure._def.subscription) return 'subscription';
const allowedProcedureTypes = ['query', 'mutation', 'subscription']
if (allowedProcedureTypes.includes(procedure._def.type)) {
return procedure._def.type;
}
throw new Error('Unknown procedure type');
};

Expand Down

2 comments on commit 51505ca

@PotatoHD404
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is issue trpc#431

@alex-streza
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good, we really need this fix so we can expose our API for public 🙏

Please sign in to comment.