'How to exclude a page in react app which is using aws amplify authenticator

I am trying to exclude one single page from amplify authenticator that I am using in my react app, but till now I haven't found any way to do so.I have tried with excluding the page route from authentication it worked in dev but giving some kind of error in production.

 <Router fallback={<span />}>
      <Switch>
        <Route path="/survey" exact component={Survey} />
        <Route path="/errors" component={ErrorLayout} />
        <AmplifyAuthenticator usernameAlias="email" hide-sign-up="true">
          <AmplifySignIn slot="sign-in" hideSignUp />
          <Route component={DashboardLayout} />
        </AmplifyAuthenticator>
      </Switch>
      <ToastContainer transition={Fade} closeButton={<CloseButton />} position={toast.POSITION.BOTTOM_LEFT} />
    </Router>

The error I am getting in production.

enter image description here

My whole react app is hosted in AWS amplify and for the backend I am using appsync.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source