Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'aws_amplify__WEBPACK_IMPORTED_MODULE_2___default.a.signUp is not a function'

I am creating a sign-up page with React, node.js and AWS cognito. When handling the signup event I get the error 'aws_amplify__WEBPACK_IMPORTED_MODULE_2___default.a.signUp is not a function'

import Auth from "aws-amplify";
handleConfirmationSubmit = async event => {
        event.preventDefault();

        this.setState({ isLoading: true });

        try {
            await Auth.confirmSignUp(this.state.email, this.state.confirmationCode);
            await Auth.signIn(this.state.email, this.state.password);

            this.props.userHasAuthenticated(true);
            this.props.history.push("/");
        } catch (e) {
            alert(e.message);
            this.setState({ isLoading: false });
        }
    }

An ideas on how resolve this error?

like image 536
Adam Avatar asked Nov 16 '25 16:11

Adam


2 Answers

I just changed from import API from "aws-amplify"; To import { API } from "aws-amplify";

like image 180
LucSuper Avatar answered Nov 18 '25 06:11

LucSuper


Change import Auth from "aws-amplify"; to import Auth from "@aws-amplify/auth";

like image 25
Adam Avatar answered Nov 18 '25 05:11

Adam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!