I am doing a project which will use Google Login in NextJs

This is my setting in OAuth 2.0
and in amplify environment variables

After I deployed the app and try to login It redirect me to http://localhost:3000 instead of the domain I set at amplify and OAuth 2.0
import NextAuth from 'next-auth';
import GoogleProvider from 'next-auth/providers/google';
export default NextAuth({
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
],
secret: process.env.NEXTAUTH_SECRET || process.env.NEXT_PUBLIC_SECRET,
});
the code above is my src/pages/api/auth/[...nextauth].ts
import { getSession, GetSessionParams, signIn } from 'next-auth/react';
import styles from '@styles/login.module.css';
import Head from 'next/head';
import gmailLogo from '@assets/g.webp';
import logo from '@assets/logo.png';
import Image, { StaticImageData } from 'next/image';
type Props = { logo: StaticImageData; gmailLogo: StaticImageData };
const Login = ({ logo, gmailLogo }: Props) => {
return (
<div className={styles.login}>
<div className={styles['login-overlay']}></div>
<Head>
<title>Login</title>
</Head>
<Image
width={logo.width}
height={logo.height}
src={logo.src}
alt="logo"
className={styles['company-logo']}
/>
<h1>
Welcome to <br />
<span>CausewayLink Visa Portal</span>
</h1>
<div
className={styles['google-login-button']}
onClick={() => signIn('google')}
>
<span>Sign in with your Gmail</span>
<Image
width={gmailLogo.width}
height={gmailLogo.height}
src={gmailLogo.src}
alt="gmail-login-logo"
/>
</div>
</div>
);
};
export async function getServerSideProps(context: GetSessionParams) {
const session = await getSession(context);
if (session) {
return {
redirect: {
destination: '/dashboard',
permanent: false,
},
};
}
return { props: { logo, gmailLogo } };
}
export default Login;
The code above is for my login page
I tried to add this command in amplify.yml in build stage, but seems no value read but from the image you can see my NEXTAUTH_URL is already set
- echo "NEXTAUTH_URL=$NEXTAUTH_URL" >> .env
Please provide any guidance, thanks in advance