question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Error: [object Object] using AuthGuard with GraphQL

See original GitHub issue

When using the AuthGuard on a controller it works fine, but when used on a GraphQL query or mutation it shows the following error in terminal:

alt text

Probably graphql is waiting for the return of a false boolean in failure case, but authentication returns a http exception

This is my example

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilmysliwieccommented, Jun 23, 2018

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: image

0reactions
cojackcommented, Jan 12, 2019

Any progress?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nestjs azure active directory and graphql - UseGuard
It is working just fine when I add a nestjs guard to a REST endpoint, but with a GrapQL resolver it is throwing...
Read more >
Error handling - Apollo GraphQL Docs
Whenever Apollo Server encounters errors while processing a GraphQL operation, its response to the client includes an errors array containing each error that ......
Read more >
Authorization - TypeGraphQL
How to use. First, we need to use the @Authorized decorator as a guard on a field, query or mutation. Example object type...
Read more >
Relations | Nestjs-query - Blog
When using the nestjs-query you can specify relations that should be exposed for the ... This prevents the n+1 problem. In ... todo-item/todo-item.entity.ts....
Read more >
Setting up a Hybrid REST & GraphQL API with NestJS and ...
ORMs, or object relational mappers, are libraries that simplify working with a relational or NoSQL database in our codebase.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found