Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

tRPC v11 support #455

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

tRPC v11 support #455

wants to merge 11 commits into from

Conversation

deldrid1
Copy link

Guessing this should be merged into a next branch, but this brings support for trpc @next (v11).

Details of this PR are in kdy1#2. This was built on top of the work done by @kdy1, as referenced in #434

Copy link

@mathmach mathmach left a comment

Choose a reason for hiding this comment

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

Tested and worked for me, thanks for share

@piccinnigius
Copy link

awesome! how to make it works with next 14?
I've made this handler:

import {createContext} from '@/utils/trpc/server';
import {createOpenApiNextHandler} from 'trpc-openapi';
import {appRouter} from "@/app/api/v1/trpc-router";

const handler = (request: Request, res: Response) => {
    return createOpenApiNextHandler({
        router: appRouter,
        createContext: createContext as any,
    })(request as any, res as any);
};

export {
    handler as DELETE,
    handler as GET,
    handler as OPTIONS,
    handler as PATCH,
    handler as POST,
    handler as PUT
};

but when i call an endpoint i have this:

 TypeError: Cannot read properties of undefined (reading 'trpc')
    at eval (webpack-internal:///(rsc)/./node_modules/trpc-openapi/dist/adapters/next.js:12:30)
    at handler (webpack-internal:///(rsc)/./app/api/v1/rest/[trpc]/route.ts:20:7)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants