Hi! I want to pass another parameter along with re...
# random
h
Hi! I want to pass another parameter along with result from graphql mutation query. However, error throws when I change my below query.
Copy code
signup: async (_, args, context, info) => {
      const result = await context.prisma.mutation.createUser(
        {
          data: {
            email: args.email,
          },
        },
        info,
      );
      return result;
When I change above query to below,
Error: Cannot return null for non-nullable field User.id.
error is always throwing. No idea why this is happening.
Copy code
signup: async (_, args, context, info) => {
      const token  = jwt.sign({ userId: args.id }, SECRET);
      console.log('token: ' + token);  // token always has a value!!
      const result = await context.prisma.mutation.createUser(
        {
          data: {
            email: args.email,
          },
        },
        info,
      );
      return {
        token,
        result,
      };
    }
Could anyone guide me to this problem?