title: NextAuth.js for authentication with Google facing [client_fetch_error] with next.js
body: <p>I am using the next-auth.js library for authentication with Google in next.js. It is working fine in the localhost but I'm facing the issue in the Production environment. I went through the next-auth documentation and I found out it is a known issue with the environmental variables. <br /></p>
  <p>The error which I am facing is:  <code>[error][client_fetch_error]</code> <a href="https://next-auth.js.org/errors#client_fetch_error" rel="nofollow noreferrer">https://next-auth.js.org/errors#client_fetch_error</a>. So I made changes in the code by adding an environmental variable which is  <code>NEXTAUTH_URL = &quot;https://domainname/&quot;</code>  as they mentioned in the documentation. Still, I am facing the same error also it is throwing a bad gateway request <code>GET https://domaniname/api/auth/session 502 </code>. <br />Also, I ensured that the clientId, clientSecret are having the correct values and the <strong>Authorized redirect URIs</strong>: https://domainname/api/auth/callback/google</p>
  <p>Could anyone help me out on how to rectify it?</p>