0

Currently, I have this on one of my NextJS pages

  const router = useRouter();
  useEffect(() => {
   if (
     query.lat === undefined ||
     query.lng === undefined ||
     query.address === undefined
   ) {
     router.push("/sellproperty");
   }
 }, []);

This works in development mode, but in production it gives me this

<Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied</Message>
  <RequestId>FF14126DD87B3C5D</RequestId>
  <HostId>
  00IHNHx4vP22yjGDxGcXUTyJ9+qVYhyGR0z/WrYl9OYm42LmONRdlSZo09KP9JdA6J+8o0MQ8r4=
  </HostId>
</Error>

The project is hosted with AWS Amplify.

HerilS
  • 21
  • 1
  • 4
  • I am not familiar with AWS but because I had a similar problem recently: Does you AWS Amplify environment know how to proxy `/sellproperty` request? Looks like, in production, it might be requesting `yourdomain.com/sellproperty` instead of your internal `/sellproperty` React route. – dugong Dec 23 '20 at 23:27
  • How would I make it request internally? – HerilS Dec 24 '20 at 03:59
  • Here, check this out: https://stackoverflow.com/questions/57449853/react-router-dom-not-working-correctly-on-amplify-console-aws – dugong Dec 24 '20 at 14:12

0 Answers0