Search code examples
aws-amplify

Amplify sendCustomChallengeAnswer does not exist


Property 'sendCustomChallengeAnswer' does not exist on type 'typeof import("{file_path}/@aws-amplify/auth/dist/esm/index")

The error code appears above despite the imports

import { Amplify } from "aws-amplify";
import Auth from '@aws-amplify/auth'
import awsconfig from '@/aws-exports';
Amplify.configure(awsconfig);

Below is how I implement the sendCustomChallengeAnswer

        verifyOtp: () => {
          Auth.sendCustomChallengeAnswer(session, otp)
          .then((user) => {
            setUser(user);
            setMessage(SIGNEDIN);
            // setSession(null);
          })
          .catch((err) => {
            setMessage(err.message);
            setOtp('');
            console.log(err);
          });
        },

Solution

  • It was replaced by confirmSignIn https://docs.amplify.aws/react/build-a-backend/auth/auth-migration-guide/