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

bug: stacktrace not log the right line #177

Open
GHChrisSu opened this issue Feb 21, 2023 · 1 comment
Open

bug: stacktrace not log the right line #177

GHChrisSu opened this issue Feb 21, 2023 · 1 comment

Comments

@GHChrisSu
Copy link

Provide environment information

System:
OS: macOS 13.2
CPU: (8) arm64 Apple M1
Memory: 94.33 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.13.0/bin/yarn
npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
Watchman: 2023.01.23.00 - /opt/homebrew/bin/watchman

Describe the bug

When a tracing event happen the trace log not at the right line. When console.trace is at post router of 7 line, but stacktrace shows packages/api/src/router/post.ts:14 which is 14 line.

Link to reproduction

https://github.com/GHChrisSu/t3-test

To reproduce

import { z } from "zod";

import { createTRPCRouter, publicProcedure } from "../trpc";

export const postRouter = createTRPCRouter({
  all: publicProcedure.query(({ ctx }) => {
    console.trace("🚀 ~ file: post.ts:9 ~ all:publicProcedure.query ~ ctx:")
    return ctx.prisma.post.findMany({ orderBy: { id: "desc" } });
  }),
  byId: publicProcedure.input(z.string()).query(({ ctx, input }) => {
    return ctx.prisma.post.findFirst({ where: { id: input } });
  }),
  create: publicProcedure
    .input(z.object({ title: z.string().min(1), content: z.string().min(1) }))
    .mutation(({ ctx, input }) => {
      return ctx.prisma.post.create({ data: input });
    }),
  delete: publicProcedure.input(z.string()).mutation(({ ctx, input }) => {
    return ctx.prisma.post.delete({ where: { id: input } });
  }),
});

Additional information

ITrace: 🚀 ~ file: post.ts:9 ~ all:publicProcedure.query ~ ctx:
at eval (webpack-internal:///(api)/../../packages/api/src/router/post.ts:14:17)
at resolveMiddleware (file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/index.mjs:383:36)
at callRecursive (file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/index.mjs:419:38)
at resolve (file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/index.mjs:447:30)
at callProcedure (file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/config-4ca0221b.mjs:226:12)
at file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/resolveHTTPResponse-b831e644.mjs:123:38
at Array.map ()
at resolveHTTPResponse (file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/resolveHTTPResponse-b831e644.mjs:120:52)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async nodeHTTPRequestHandler (file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/nodeHTTPRequestHandler-34404221.mjs:51:20)
at async file:///Users/suhao/github/t3-test/node_modules/@trpc/server/dist/adapters/next.mjs:39:9
at async Object.apiResolver (/Users/suhao/github/t3-test/node_modules/next/dist/server/api-utils/node.js:372:9)
at async DevServer.runApi (/Users/suhao/github/t3-test/node_modules/next/dist/server/next-server.js:488:9)
at async Object.fn (/Users/suhao/github/t3-test/node_modules/next/dist/server/next-server.js:751:37)
at async Router.execute (/Users/suhao/github/t3-test/node_modules/next/dist/server/router.js:253:36)
at async DevServer.run (/Users/suhao/github/t3-test/node_modules/next/dist/server/base-server.js:384:29)
at async DevServer.run (/Users/suhao/github/t3-test/node_modules/next/dist/server/dev/next-dev-server.js:743:20)
at async DevServer.handleRequest (/Users/suhao/github/t3-test/node_modules/next/dist/server/base-server.js:322:20)

@juliusmarminge
Copy link
Member

No idea why this happens 🤔

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

2 participants