elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.87k stars 211 forks source link

tRPC Mutation or Query no found on path #783

Open bibauporto opened 1 month ago

bibauporto commented 1 month ago

What version of Elysia is running?

Latest

What platform is your computer?

W11

What steps can reproduce the bug?

Using tRPC plugin.

What is the expected behavior?

tRPC

What do you see instead?

tRPC mitation/query does not exist

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

Yes

SaltyAom commented 4 weeks ago

Can you provide more context on your use case? Elysia doesn't support with tRPC adapter, maybe perhaps you meant tRPC plugin?

bibauporto commented 3 weeks ago
export const app = new Elysia()
    .use(
        cors({
            origin: process.env.ORIGIN?.split(','),
        }),
    )
       //not working 
    .use(trpc(appRouter, { createContext }))

        // working version:
    // .all('/trpc/*', async (opts) => {
    //  const res = await fetchRequestHandler({
    //      endpoint: '/trpc',
    //      router: appRouter,
    //      req: opts.request,
    //      createContext,
    //  })
    //  return res
    // })

          "cookies": [],
          "content": {
            "mimeType": "application/json",
            "size": 795,
            "text": "[{\"error\":{\"message\":\"No \\\"mutation\\\"-procedure on path \\\"users.login\\\"\",\"code\":-32004,\"data\":{\"code\":\"NOT_FOUND\",\"httpStatus\":404,\"stack\":\"TRPCError: No \\\"mutation\\\"-procedure on path \\\"users.login\\\"\\n    at new TRPCError (C:\\\\00_Projects\\\\main\\\\node_modules\\\\@elysiajs\\\\trpc\\\\dist\\\\index.mjs:52:5)\\n    at callProcedure (C:\\\\00_Projects\\\\main\\\\node_modules\\\\@elysiajs\\\\trpc\\\\dist\\\\index.mjs:308:15)\\n    at <anonymous> (C:\\\\00_Projects\\\\main\\\\node_modules\\\\@elysiajs\\\\trpc\\\\dist\\\\index.mjs:859:24)\\n    at inputToProcedureCall (C:\\\\00_Projects\\\\main\\\\node_modules\\\\@elysiajs\\\\trpc\\\\dist\\\\index.mjs:856:37)\\n    at map (:1:11)\\n    at <anonymous> (C:\\\\00_Projects\\\\main\\\\node_modules\\\\@elysiajs\\\\trpc\\\\dist\\\\index.mjs:971:28)\\n    at processTicksAndRejections (:12:39)\",\"path\":\"users.login\"}}}]"
          },