Skip to content

Potential Bug For MailHelper #144

@dmc2015

Description

@dmc2015

Hello

I am not sure if it is a bug or if I did something wrong.

I was getting this error:

{
  "errors": [
    {
      "message": "undefined method `confirmation_query' for #<#<Class:0x00007fcd3cf1b5b0>:0x00007fcd3cf19c88>\nDid you mean?  confirmation_url\n               confirmation_path",

I eventually was able to find where confirmation_query is located.

I resolved it by adding:

include GraphqlDevise::MailerHelper

to my Graphql Schema

I am wondering if this is the correct way to do this or if there is a better way. I don't see MailerHelper in the documentation so I figured maybe it is supposed to be included in some other way. Considering this is security I prefer it to be as standard as possible.

Steps to reproduce

(Write your steps here:)

  1. Add and go through normal setup
  2. Use the default route
  3. Use the Authenticate In Graphql
  4. Send an authentication request via graphiql
mutation signUp {
   userSignUp (
    email: "user@gmail.com"
    password: "xxx"
    passwordConfirmation: "xxx"
  ) {
    authenticatable { email }
    }
}

Expected behavior

I expect it to authenticate the user

(Write what you thought would happen.)

Actual behavior

Returns an error:

  "errors": [
    {
      "message": "undefined method `confirmation_query' for #<#<Class:0x00007fcd3cf1b5b0>:0x00007fcd3cf19c88>\nDid you mean?  confirmation_url\n               confirmation_path",

Sample Files:

Graphql Schema

# frozen_string_literal: true
class Schema < GraphQL::Schema
  # include GraphqlDevise::MailerHelper

  # It's important that this line goes before setting the query and mutation type on your
  # schema in graphql versions < 1.10.0
  use GraphqlDevise::SchemaPlugin.new(
    query:            Types::QueryType,
    mutation:         Types::MutationType,
    resource_loaders: [
      GraphqlDevise::ResourceLoader.new('User', only: %i[login confirm_account sign_up])
      # GraphqlDevise::ResourceLoader.new('User', only: %i[login confirm_account logout sign_up update_password send_password_reset check_password_token] )

    ]
  )

  mutation(Types::MutationType)
  query(Types::QueryType)

  use GraphQL::Execution::Interpreter
  use GraphQL::Analysis::AST

  use GraphQL::Pagination::Connections
end

User Model:

# frozen_string_literal: true

class User < ActiveRecord::Base

  before_validation do
    self.uid = email if uid.blank?
  end

  # Include default devise modules.
  devise :database_authenticatable, :registerable,
          :recoverable, :rememberable, :trackable, :validatable,
          :confirmable, :omniauthable
  include GraphqlDevise::Concerns::Model

  include DeviseTokenAuth::Concerns::User


end

Devise Token Auth.rb

# frozen_string_literal: true

DeviseTokenAuth.setup do |config|
  config.change_headers_on_each_request = false
  config.default_confirm_success_url = 'confirmed'
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageNeeds to be clasified by the mantiners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions