title: Cognito UnknownError after turn on device registration
body: <p>As per requirement, I need to turn on device registration to <code>Always</code>. However, our SRP flow starts failing with the below issue.</p>
  
  <pre><code>{ code: 'UnknownError', message: 'Unknown error, the response body from fetch is: undefined' }
  </code></pre>
  
  <p>After doing some research, I found one similar <a href="https://stackoverflow.com/questions/40219518/aws-cognito-unauthenticated-login-error-window-is-not-defined-js">post</a>, but it seems like the only solution is to turn device registration off. </p>
  
  <p>It's failing while running <code>node get-token.js</code> script to retrieve token for our CI/CD testing pipeline.</p>
  
  <pre><code>    cognitoUser.authenticateUser(authCfg, {
          onSuccess: function (result) {
              console.log("Result : ", result);
              const token = result.getAccessToken().getJwtToken();
              resolve(token)
          },
          onFailure: function(err) {
              console.error("Failure : ", err);
              console.log(new Error().stack);
              reject(new Error("An error occurred: " + err))
          },
          newPasswordRequired: function (userAttributes, requiredAttributes) {
              cognitoUser.completeNewPasswordChallenge(p, userAttributes, this);
          },
      });
  </code></pre>