여느 때와 다를거 없이 작업 후에 테스트를 해보기 위해서 postman에서 send 버튼을 눌렀습니다
그런데
무한 로딩에서 나오지를 못하는 현상이 일어났습니다..
자주는 아니지만 가끔씩 일어나는 일이여서 의심되는 곳에 로그를 남기며 해당 구문이 잘 작동하는지 테스트를 해봤습니다.
의심이 되는 곳은 로그가 잘 찍히고 있었습니다
설마라는 생각을 가지고 return 바로 윗 부분에 로그를 남겨봤는데 return 바로 직전까지 로그가 잘 찍혔습니다.
원초적인 방법인 ide를 껐다 켜보기, postman 껐다 켜보기, 컴퓨터를 껐다 켜보기..
원초적인 방법으로 해결이 됐었던 경우도 있었어서 (왜 그런지는 의문) 해봤지만 결과는 똑같았습니다.
이런 경우는 처음이였어서 구글링을 시작했습니다.
뾰족한 방법은 없었고 오타에 대한 언급들이 주를 이루고 있어서 찾아봤지만 제눈에는 보이지 않았습니다..
포스트맨 문제는 아니라 판단하여 사용중이던 nestjs 공식문서를 읽기 시작했습니다..
nestjs 공식문서를 읽어보던 도중....
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reac
docs.nestjs.com
WARNING
Nest detects when the handler is using either @Res() or @Next(), indicating you have chosen the library-specific option. If both approaches are used at the same time, the Standard approach is automatically disabled for this single route and will no longer work as expected. To use both approaches at the same time (for example, by injecting the response object to only set cookies/headers but still leave the rest to the framework), you must set the passthrough option to true in the @Res({ passthrough: true }) decorator.
라고 적혀있었습니다...
번역기 친구의 도움을 받아 확인해본 결과..
@Res 방식을 사용하면 이 단일 경로에 대해 표준 접근 방식이 비활성화 되어 더 이상 작동하지 않는다라고 되어있습니다(?).
데코레이터 에서 passthrough 옵션을 설정해주면 된다라고 되어있지만 @Res를 사용하고 있지 않아서 데코레이터를 지웠더니....
그랬더니 정상적으로 포스트맨이 작동했습니다
@Res를 사용해야한다면 passthrough 옵션을 true로 설정하여 사용하라고 안내되어 있습니다
- 해당 에러에 대한 참고 글
Using @Res() the response freezes · Issue #5448 · nestjs/nest
Bug Report Current behavior When the controller method has @res as a parameter, the response freezes Input Code ... import {Response} from 'express' import {Res} from '@nestjs/common...
github.com
'Dev > Error' 카테고리의 다른 글
[Postman] file과 body 한 번에 요청하기 (feat.삽질) (0) | 2022.09.02 |
---|---|
npm install 설치시 npm ERR! code ERESOLVE 에러 (0) | 2022.08.07 |
[Error] MySQL: Cannot add foreign key constraint 에러 해결 (0) | 2022.07.17 |
Cannot read properties of undefined (reading 'split') 에러 (0) | 2022.02.12 |
[Error] npm install 후 reify~ 프리징 (2) | 2022.01.10 |