Comments (12)
This isn't AuthGuard
issue. I did a small research and it seems that this is how apollo serializes thrown error. If you throw "Test", it would print the following output:
Error: Test
Whilst message
property of the HttpException
is an object. Regardless of this weird console output, the GraphQL response looks perfectly fine:
from passport.
Duplicate of #4 🙂
from passport.
They are different bugs.
I've updated to version v1.0.9
and this still persists.
from passport.
Please, make sure to get rid of internal @nestjs/common
package installed by @nestjs/passport
(full path: node_modules/@nestjs/passport/node_modules/@nestjs/common)
from passport.
node_modules/@nestjs/passport/node_modules/@nestjs/common
is not present, and still the error keeps appearing
from passport.
Okay.
But in general, if framework handled exception and proper response returned -
why it should be displayed in console ?
I mean, exception usually means something wrong happened in your application - and you want to crash it.
Don't you agree, @kamilmysliwiec ?
from passport.
This output comes from the Apollo server @ph55
from passport.
I understand that.
But, you have power of suppressing such errors when wrapping it, don't you? Or am I wrong.
It's just question of design.
from passport.
@ph55, yeah, you have, using formatError
option from Apollo. It has nothing to do with Nest.
from passport.
I don't think formatError
helps much.
I'll explain in another example.
User authentication service:
const AuthenticationError = createError('AuthenticationError', {
message: 'Username or password are incorrect'
});
if (!match) {
throw new AuthenticationError();
}
Using format error gives me desired result in output:
{
"data": {
"login": null
},
"errors": [
{
"message": "Username or password are incorrect",
"name": "AuthenticationError",
"time_thrown": "2018-06-24T13:47:39.214Z",
"data": {}
}
]
}
But error still thrown in console:
[Nest] 4060 - 2018-6-24 16:47:37 [NestApplication] Nest application successfully started +30ms
AuthenticationError: Username or password are incorrect
at UserService.<anonymous> (C:\Users\alex\Documents\_dev\nest-apps\src\@core\user\user.service.ts:51:13)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\alex\Documents\_dev\nest-apps\src\@core\user\user.service.ts:16:58)
at <anonymous>
So the questions are:
- Why its still thrown.
- How to suppress it.
- Am I stupid ?
from passport.
It's apollo-server config.
apollographql/apollo-server#894
Thanks for help.
from passport.
Any progress?
from passport.
Related Issues (20)
- passport-steam Guide will be appreciated HOT 1
- How about changing the constructor parameter type of PassportStrategy like this? HOT 1
- validate(payload: any) in Implementing Passport JWT doc it's not correct HOT 2
- AuthGuard on Local Strategy return undefinded HOT 1
- overwhelmed by error logs HOT 6
- Pretty magical thing: request.authInfo = undefined and behavior is very strange HOT 3
- Unable to preserve session in passport v0.6.0 HOT 2
- v10 does not allow typing on custom `getRequest` method in class with extended AuthGuard HOT 1
- AuthGuard does not work with authentication-only strategies HOT 1
- Support for [email protected] HOT 3
- using @Inject(REQUEST) req breaks passport. HOT 4
- Guard Order Scope affects order of execution HOT 2
- Can a new release be pushed? HOT 3
- Nest can't resolve dependencies of the JwtAuthenticationGuard after upgrade 8.1.0 to 8.1.1 HOT 9
- Cannot read properties of undefined (reading 'property') HOT 1
- Using custom passport from a different package causes error HOT 1
- Dependency tree discrepancy HOT 2
- PassportStrategy interface does not contain validate() HOT 2
- The defaultStrategies cannot be set during runtime in the AuthGuard HOT 1
- Typing of the result of getAuthenticateOptions is misleading/incorrect HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passport.