Amplify-js: Unknown error, the response body from fetch is: undefined

Created on 19 Aug 2018  路  6Comments  路  Source: aws-amplify/amplify-js

When I am trying to login Getting this error
Unknown error, the response body from fetch is: undefined

Here Is my code What I have done

// console.log(request)
const loginDetails = {
Username: '[email protected]',
Password: '*****'
}
const authenticationDetails = new AmazonCogintoIdentity.AuthenticationDetails(loginDetails)

        const userDetails = {
            Username: '[email protected]',
            Pool: userPool
        }
        const cognitoUser = new AmazonCogintoIdentity.CognitoUser(userDetails)

        cognitoUser.authenticateUser(authenticationDetails, {
            onSuccess: function (result) {
                console.log('access token + ' + result.getAccessToken().getJwtToken());
                console.log('id token + ' + result.getIdToken().getJwtToken());
                console.log('refresh token + ' + result.getRefreshToken().getToken());
                console.log(result)
            },
            onFailure: function(err) {
                console.log(err);
                // console.log('not onSuccess')
            },
        });

please Help me to solve this error

Auth Cognito

Most helpful comment

I got the same error, Im using Web browser to login.

All 6 comments

@Aslamdesusa are you using this in Node.js? If so, you need to install a node-fetch:
https://aws-amplify.github.io/amplify-js/media/authentication_guide#nodejs-support

Thank you @mlabieniec it was helpful

@Aslamdesusa are you using this in Node.js? If so, you need to install a node-fetch:
https://aws-amplify.github.io/amplify-js/media/authentication_guide#nodejs-support

Link fails to refer ^^^

I got the same error, Im using Web browser to login.

I moved to CognitoIdentityServiceProvider from 'aws-sdk'. It had all the functionality i needed, and worked.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html

Typescript Node solution.

Closing the issue as you will no longer receive unknown error in the latest version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

callmekatootie picture callmekatootie  路  3Comments

TheRealRed7 picture TheRealRed7  路  3Comments

karlmosenbacher picture karlmosenbacher  路  3Comments

oste picture oste  路  3Comments

rayhaanq picture rayhaanq  路  3Comments