Graphql mutations without input args did't work

I created a NestJS sample, I add a Mutation to sync user info to my backend.

And added the following codes, the @GqlUser is to extract user info from my jwt token.

  @Mutation((returns) => UpdateUserResult)
  @UseGuards(JwtAuthGuard)
  updateUser(@GqlUser() user: UserPrincipal): Observable<UpdateUserResult> {
    console.log('gql user:', user);
    const { userId, email, name } = user;
    return this.usersService.update({ id: userId, email, name }).pipe(
      map((b) => ({
        success: b,
      })),
    );
  }

But when executing this mutation by the following forms.

// failed due to *the expectedName is not a ")"*
mutation SyncUser{
   updateUser(){
       success
   }
}

or

// failed due to *this.subQuery is not a function*
mutation {
    updateUser{
       success
   }
}

It always tried to retrieve the input arguments, failed.

Your second mutation operation looks correct but the error is notably different. Rather than being a GraphQL error it appear to be an error happening from a misconfiguration of TypeORM and bubbling up to your resolver; there’s a number of similar errors coming up on Google that relate to TypeORM.