파크로그
[Nest] Cannot determine a GraphQL input type for the "...". Make sure your class is decorated with an appropriate decorator.
Backend/🐯 Nest 2021. 8. 26. 21:11

fakeDB [] 에서 sqlite 로 옮기던 와중, Many-To-One, One-To-Many 관계 설정을 하고 있었는데, 마지막 단계에서 아래와 같은 오류가 발생했다. Cannot determine a GraphQL input type for the "...". Make sure your class is decorated with an appropriate decorator. 아무리 눈을 씻고 찾아봐도 InputType 을 넣어주지 않은 클래스는 없었다. 혹시나 싶어 create input dto 를 뒤져보면서, OmitType 을 PickType 으로 로직을 바꾸어 사용해보니 위와 같은 에러가 사라졌다. // 에러난 로직 @InputType() export class CreateEpisodeInp..

article thumbnail
[Nest] Cannot find module 'class-transformer/storage' , Cannot find module 'ts-morph'
Backend/🐯 Nest 2021. 8. 25. 22:35

class-transformer 모듈 관련 오류였는데, @nestjs/graphql 버전이 8 버전으로 업그레이드 된 상황에서 강의상황에 맞춰가기 위해 7.9.4 버전으로 사용하고 있었음, 그 상황에서 발생한 오류라고 판단 https://github.com/typestack/class-transformer/issues/566 global 로 설치된 nestjs cli 를 버전 업 하고, nest js docs 에서 제시한 새로운 graphql 설치 방향으로 진행 // cli 업데이트 $ npm i -g @nestjs/cli // graphql 설치 $ npm i @nestjs/graphql graphql apollo-server-express@2.x.x https://docs.nestjs.kr/graph..

[Nest] Cannot determine a GraphQL output type for the "...". Make sure your class is decorated with an appropriate decorator.
Backend/🐯 Nest 2021. 8. 25. 22:35

Cannot determine a GraphQL output type for the "...". Make sure your class is decorated with an appropriate decorator.GraphQL 에서 Return Type을 통일시켜주기 위해 Output Dto 를 만들었으나, 해당 Output 을 적용하려고 하니 생긴 오류Output 에도 데코레이터를 적용시켜줘야함.GraphQL 에게 타입을 알려주는 Field 도 깜빡하지 말고 넣자.import { ObjectType } from '@nestjs/graphql'; import { CommonOutput } from 'src/common/dtos/output.dto'; import { Podcast } from '../ent..

[Nest] TS2345: Argument of type 'TypedPropertyDescriptor<'somthing'>' is not assignable to parameter of type 'number'
Backend/🐯 Nest 2021. 8. 25. 22:34

TS2345: Argument of type 'TypedPropertyDescriptor Podcast[]>' is not assignable to parameter of type 'number' GraphQL Query 를 작성할 때, @nestjs/common 이 아닌 @nestjs/graphql 에서 import 되어야 한다. 자동으로 common 에서 import 되는 경우가 많으니 주의하도록 하자. import { Query } from '@nestjs/common'; import { Resolver } from '@nestjs/graphql'; import { Podcast } from './entities/podcast.entity'; import { PodcastsService } from..