nestjs / passport

Passport module for Nest framework (node.js) 🔑

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using custom passport from a different package causes error

danielyag opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I created a custom passport. I have multiple services under the same repo (monorepo), so I located the custom passport in a shared directory and I import it from there.
When providing wrong credential, instead of getting unauthorized exception, I'm getting internal server error.
Note: importing the package instead of installing - works fine.

Minimum reproduction code

https://github.com/danielyagodaev/custom-passport

Steps to reproduce

  1. cd packages/shared
  2. npm i
  3. npm run build
  4. cd ../packages/server
  5. npm i
  6. npm run start:dev
  7. curl -i 'localhost:3000' (internal server error)
  8. curl -i -H "secret:123" 'localhost:3000' (OK)

Expected behavior

When providing wrong credentials, I would expect getting 401 unauthorized error.

Package version

8.2.1

Passport version

0.5.2

NestJS version

8.4.4

Node.js version

16.14.2

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.