question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown error, the response body from fetch is: undefined

See original GitHub issue

I am using in Node.js the following versions “amazon-cognito-identity-js”: “^2.0.29”, “node-fetch”: “^2.2.0”,

I am trying to signUp and authenticateUser in my app.

Initially I was getting “fetch undefined” when I call singUp. Which was fixed by adding the node-fetch library. Now I can successfully signUp users.

Now I am getting the error “Unknown error, the response body from fetch is: undefined” when I call authenticateUser method. The code is as following.

`app.post(‘/login’, (req, res) => { var authenticationData = { Username: req.body.email, Password: req.body.password, };

    var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);

    var userData = {
        Username: req.body.email,
        Pool: userPool
    };

    var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
    cognitoUser.authenticateUser(authenticationDetails, {
        onSuccess: function (result) {
            var accessToken = result.getAccessToken().getJwtToken();

            /* Use the idToken for Logins Map when Federating User Pools with identity pools or when passing through an Authorization Header to an API Gateway Authorizer*/
            var idToken = result.idToken.jwtToken;
        },
        onFailure: function (err) {
            console.log(err);
        }
    });`

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
sanudatta11commented, Oct 2, 2018

I removed the remember device and set it to no. It worked.

0reactions
github-actions[bot]commented, Jun 13, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown error, the response body from fetch is undefined
The problem is that i get an error: Unknown error, the response body from fetch is undefined. I already have node-fetch on the...
Read more >
Error and Warning Dictionary | Twilio
Below is a full list of all possible Twilio REST API error codes. Read our guidance on debugging your Twilio application for general...
Read more >
HTTP status and error codes for JSON | Cloud Storage
Error responses usually include a JSON document in the response body, which contains information about the error. The following examples show some common...
Read more >
fetch() - Web APIs | MDN
A fetch() promise only rejects when a network error is encountered ... method is 'GET' or 'HEAD' and the body is non-null or...
Read more >
How to Fix "Error 520: Web Server Is Returning an Unknown ...
This problem occurs when your site lacks an HTTP status code or response body. To resolve it, make sure your DNS settings are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found