Removing @auth
directive seems to have no effect
#1238
-
I'm using Fastify as a server, instead of Express; and Mercurius as my GraphQL layer instead of Apollo. The schema building code in question looks like this: const accountsGraphQLPlugin: FastifyPluginCallback<AccountsGraphQLPluginOptions> =
(fastify, opts, done) => {
// set up the Accounts GraphQL server.
const accountsGraphQL = AccountsModule.forRoot({
accountsServer: fastify.accounts,
});
fastify.decorate('accountsGraphQL', accountsGraphQL);
const schema = makeExecutableSchema({
typeDefs: mergeTypeDefs([accountsGraphQL.typeDefs, typeDefs]),
resolvers: mergeResolvers([accountsGraphQL.resolvers, resolvers]),
schemaDirectives: {
...accountsGraphQL.schemaDirectives, // <---- installs the `@auth` directive into my schema
},
});
//... truncated
} I have extended the schema provided by the extend type Mutation {
#... truncated
sendResetPasswordEmail(email: String!): Boolean @auth
#... truncated
} I am using the authentication directive provided by extend type Mutation {
#... truncated
sendResetPasswordEmail(email: String!): Boolean
#... truncated
} I am still getting this error message. I have no idea why, but I dug a little deeper anyway. I put a breakpoint on This points to it either being a problem with my schema (shown above), the So I have no idea what's going on, I'm pretty stuck. Have any of your seen this before? I am using Mercurius Codegen (like GraphQL Codegen) but it's called Update 9-17-2022When I commented out the schema directives: const schema = makeExecutableSchema({
typeDefs: mergeTypeDefs([accountsGraphQL.typeDefs, typeDefs]),
resolvers: mergeResolvers([accountsGraphQL.resolvers, resolvers]),
schemaDirectives: {
// ...accountsGraphQL.schemaDirectives, // <---- installs the `@auth` directive into my schema
},
}); This uses my existing authentication. The request went through just fine. So probably something about how the I'm going to use this as a workaround for now, since I'm using mercurius auth instead, and it's more advanced than just testing for a null user. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Should be fixed in 1.0: #1258 |
Beta Was this translation helpful? Give feedback.
Should be fixed in 1.0: #1258