Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for app dir? #97

Open
tonyxiao opened this issue Nov 20, 2023 · 3 comments
Open

Support for app dir? #97

tonyxiao opened this issue Nov 20, 2023 · 3 comments

Comments

@tonyxiao
Copy link

The example only covers pages dir

@Haschtl
Copy link

Haschtl commented Nov 20, 2023

I wanted to get rid of all my pages-routing and trpc-panel was the last one there.
It's actually pretty simple to adapt it to the app-router, here is my solution (route.ts anywhere in app-router)

import { NextResponse } from 'next/server';
import { renderTrpcPanel } from 'trpc-panel';

import { appRouter } from '@/server';

export async function GET(req: Request) {
  return new NextResponse(
    renderTrpcPanel(appRouter, {
      url: '/api/trpc',
      transformer: 'superjson',
    }),
    {
      status: 200,
      headers: [['Content-Type', 'text/html'] as [string, string]],
    },
  );
}

Maybe this should be added to the docs

@tonyxiao
Copy link
Author

Hmm, i'm getting this error for some reason when I move from pages router to app router.

⨯ RangeError: Maximum call stack size exceeded
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
    at Module.zodToJsonSchema (webpack-internal:///(rsc)/../../node_modules/.pnpm/[email protected][email protected]/node_modules/zod-to-json-schema/dist/esm/index.js:43:107)

@souzjfe
Copy link

souzjfe commented Aug 28, 2024

I'm getting this error:

trpc-panel: Failed to parse procedure sayHello, Couldn't parse node.
trpc-panel: Failed to parse procedure , Router doesn't have any successfully parsed children.

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

No branches or pull requests

3 participants