Code Monkey home page Code Monkey logo

trpc-nestjs-adapter's People

Contributors

macstr1k3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

trpc-nestjs-adapter's Issues

Infinite loading when Prisma module injected into resolved dependency

Hi, thanks for the great adapter!

I'm trying it out but having issues resolving services that have a Prisma service injected into them (most of the services in the application), which is very similar to the example in the Nest docs: https://docs.nestjs.com/recipes/prisma#use-prisma-client-in-your-nestjs-services. I just get an infinite loading spinner when I try to access any of the trpc endpoints. It seems to work when I use a service in tRPC that doesn't have any injected dependencies.

Does anyone have any ideas why this isn't resolving? Is there any more information I can provide to help debug this? Would love to be able to use this properly!

EDIT: Tried nestjs-prisma too and this exhibits the same behavior. NodeJS ran out of memory after hitting the tRPC endpoint.

Authrization via context

I have implemented NestJS connection to tRPC without your adapter, and found your solution looking for a way to authorize via context, but I see that you don't have it in your example either. Perhaps you have some ideas?

I, just like in your implementation, albeit in a different way, have access to services to call them in query and mutation, but I don't in createContext.

Brainstorm: decorators for routing procedures?

I am wondering if there is a way to create custom decorators to route the procedures, i.e.

@Controller('api/cats')
export class CatsController {
  @Mutation({ input: z.object({ name: z.string(), }).optional() })
  createCat(@Input() input: { name: string }) {
    // do stuff
  }

  @Query({ input: z.object({ id: z.string(), }).optional() })
  getCat(@Input() input: { id: string }) {
    // do stuff
  }
}

What's your initial take? I can work on a PoC

Not an issue - I just don't know where to put what files?

Hi. I want to use this and try it out but i don't know how to use it exactly.. i see an example folder, so do i need to copy that whole folder including the /lib into my project? Or how does this work? I don't see how to run the example you have to see it working. Should I be able to?

conflicting peer dependencies

(my use case is a monorepo with a single node_modules for front end and backend).
reproduce:

mkdir zz
cd zz
npm init
npm install trpc-nestjs-adapter @trpc/client @trpc/server

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @trpc/[email protected]
npm ERR! node_modules/@trpc/server
npm ERR! @trpc/server@"" from the root project
npm ERR! peer @trpc/server@"10.11.0" from @trpc/[email protected]
npm ERR! node_modules/@trpc/client
npm ERR! @trpc/client@"
" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! trpc-nestjs-adapter@"" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @trpc/[email protected]
npm ERR! node_modules/@trpc/server
npm ERR! peer @trpc/server@"~10.10.0" from [email protected]
npm ERR! node_modules/trpc-nestjs-adapter
npm ERR! trpc-nestjs-adapter@"
" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/rk/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rk/.npm/_logs/2023-02-13T00_02_48_304Z-debug-0.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.