Authorization via decorators type-graphql in combination with express-graphql throws 500 error on authorization failure #1075
Unanswered
Jackywathy
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm running into an issue when using
type-graphql
in conjunction withexpress-graphql
. When I try to access an endpoint while not authorized, the server returns the appropriate error message, but with a 500 error code. An example response below:I believe the reason for this is because the
data
attribute is set tonull
, which is technically against the graphql spec.express-graphql
expects data to be either not equal tonull
or not present, and thus throws a 500 error. Is there any workaround to this problem? Thanks.Below is my authorization decorator code and the resolver in question, which I have applied.
Beta Was this translation helpful? Give feedback.
All reactions