inflearn logo
강의

講義

知識共有

しっかりしたバックエンドNestJS、基礎から深化まで

Swagger APIセキュリティ設定&ログインAPIフロントエンドとの接続

expressBasicAuth 에러

417

devops

投稿した質問数 2

1

(node:33188) UnhandledPromiseRejectionWarning: TypeError: (0 , express_basic_auth_1.default) is not a function

    at bootstrap (C:\Users\dial\NestJS\working\letsstart\project\src\main.ts:15:21)

    at processTicksAndRejections (internal/process/task_queues.js:95:5)

(Use `node --trace-warnings ...` to show where the warning was created)

(node:33188) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:33188) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

위와 같은 오류가 뜨는데요

expressBasicAuth 미들웨어를 추가하니까 뜹니다. 이유가 무엇일까요..

 app.use(
    ['/docs''/docs-json'],
    expressBasicAuth({
      challenge: true,
      users: {
        [process.env.SWAAGER_USER]: process.env.SWAGGER_PASSWORD,
      },
    }),
 );
 
 

 

express mongodb nodejs ssr NestJS

回答 2

4

windflow

import * as expressBasicAuth from 'express-basic-auth';

1

amamov

안녕하세요! :)

해당 에러는 미들웨어에서 데이터 전달이 실패한 경우 많이 발생하는 에러입니다. 전체 코드 보여주실 수 있나요?

0

devops

해결되었습니다 감사합니당.!

프로젝트 환경 세팅할 때 최신 노드 버젼을 사용하시는 분들은 참고하셔도 좋을 것 같아요~

2

77

1

DTO에 대한 질문

1

86

2

백엔드 MVC에서 View의 역할은 무엇인가요?

1

91

2

추가 업데이트 관련 건

0

89

2

nest js 버전문제

0

79

2

mongdb 스키마 공식 문서와 형태가 다른 이유 궁금합니다.

0

103

1

라인 끝에 에러 표시(eslint) 때문에 구글 찾아 보니.

0

72

1

전체 고양이 조회 라우터 중 error.message 오류

0

66

1

캡슐화 추가 설명 중 단일책임원칙 관련 질문

0

103

0

42강 고양이끼리 소통 댓글 구현 중 Schema hasn't been registered for model 'comments' 에러 해결

0

80

1

채팅 이슈

0

132

1

모듈이 더 이상 지원하지 않는답니다

0

205

1

오류가 있습니다

0

105

1

import 에서 오류가 납니다

0

126

1

이런 오류가 나옵니다

0

99

1

에러가 발생합니다

0

108

1

프론트 에러 뜨는데 수정 안해주시나요

0

154

1

emit() broadcast.emit() 질문있습니다

0

101

1

서버연결이 안됩니다.

1

403

1

[PM2][ERROR] Command not found

0

517

1

S3에 업로드까지는 성공했는데 사진이 나오지 않습니다.

0

243

1

error_code : Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.ts(2339)

0

600

1

jwt를 따로 연습하고 있는데 env를 못읽는 것 같습니다.

0

317

2

Ec2로 안하시는 이유가 있을까요?

0

342

1