title: Error implementing NextAuth credentials with custom login and backend
body: <p>I am implementing NextAuth with my NextJS(GraphQL) app. I have this error:</p>
  <pre><code>Unhandled Runtime Error
  TypeError: Cannot use 'in' operator to search for 'credentials' in null
  </code></pre>
  <p>The network error also shows:</p>
  <p><strong>Error: HTTP GET is not supported for /api/auth/session</strong></p>
  <p><strong>Error: HTTP GET is not supported for /api/auth/providers</strong></p>
  <p>I am not making a <code>GET</code> request anywhere I know. My code is below:</p>
  <p><code>pages/api/[...nextauth.js]</code></p>
  <pre><code>
  const providers = [
    Providers.Credentials({
      name: 'Credentials',
      authorize: async (credentials) =&gt; {
        try {
          const user = await &lt;GraphQL Logic to fetch user&gt;
  
          if (user) {
            return {status: 'success', data: user.data.user}
          } 
        } catch (e) {
          const errorMessage = e.response.data.message
          // Redirecting to the login page with error messsage in the URL
          throw new Error(errorMessage + '&amp;email=' + credentials.email)
        }
  
      }
    })
  ]
  
  const callbacks = {
    async jwt(token, user) {
      if (user) {
        token.accessToken = user.data.token
      }
  
      return token
    },
  
    async session(session, token) {
      session.accessToken = token.accessToken
      return session
    }
  }
  
  const options = {
    providers,
    callbacks,
    pages: {
      error: '/login' // Changing the error redirect page to our custom login page
    }
  }
  
  export default (req, res) =&gt; NextAuth(req, res, options)
  </code></pre>
  <p><code>pages/login.js</code></p>
  <pre><code>&lt;form onSubmit={(e) =&gt; handleLogin(e)}&gt;
              &lt;input value={email} onChange={(e) =&gt; setEmail(e.target.value)} /&gt;
              &lt;input type='password' value={password} onChange={(e) =&gt; setPassword(e.target.value)} /&gt;
              &lt;button type='submit' disabled={isLoginStarted}&gt;Log In&lt;/button&gt;
            &lt;/form&gt;
  </code></pre>
  <p><code>handleLogin method</code></p>
  <pre><code>const handleLogin = (e) =&gt; {
      e.preventDefault()
      setIsLoginStarted(true)
      signIn('credentials',
        {
          email,
          password,
          callbackUrl: `${window.location.origin}/welcome`
        }
      )
    }
  </code></pre>