Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-amplify ^1.2.5-unstable.13 : Unhandled Rejection (TypeError): Cannot read property 'clientMetadata' of undefined #4411

Closed
DsEsteban opened this issue Nov 15, 2019 · 5 comments
Labels
question General question

Comments

@DsEsteban
Copy link

im using the unstable version bc i need some changes there in order to work fine with NextJs framework. But, when im trying the basic funcionality:

await Auth.signIn({ username, password, }) .then(data => { console.log('authData=>', data); }) .catch(err => { console.log('errLogin=>', err); });

I got the next error message:
Unhandled Rejection (TypeError): Cannot read property 'clientMetadata' of undefined
AuthClass.push../node_modules/@aws-amplify/auth/lib-esm/Auth.js.AuthClass.signIn.

may you please give me any advice to fix this?

@DsEsteban DsEsteban added the question General question label Nov 15, 2019
@RyosukeHashimotoGithub
Copy link

try it:
Amplify.configure()
https://aws-amplify.github.io/docs/js/authentication

@mlabieniec
Copy link
Contributor

@DsEsteban what does your next.config.js file look like? See working example here:
#3854 (comment)

@haverchuck
Copy link
Member

haverchuck commented Nov 20, 2019

@DsEsteban After using the next.config.js that @mlabieniec cites above, I have authentication working on a very basic next.js app which looks like this:

import React from 'react';
import {ReactDOM } from 'react-dom';
import './App.css';
import { Authenticator, withAuthenticator } from 'aws-amplify-react';
import Amplify, {Auth} from 'aws-amplify';
// Get the aws resources configuration parameters
import awsconfig from './aws-exports'; // if you are using Amplify CLI

Auth.configure(awsconfig);

const signIn = async() => {
    await Auth.signIn({ username:'testuser', password:'testpw', }) .then(data => { console.log('authData=>', data); }) .catch(err => { console.log('errLogin=>', err); });
}

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <button onClick={signIn}>Sign In</button>
      </header>
    </div>
  );
}

export default App;

As you can see I'm more or less using the .signIn code sample you've provided. Have you tried using the config @mlabieniec suggests? I don't think that's necessarily the root of your issue, but it's worth a shot. Also, is this happening with a standard 'npm run dev' or in some other particular case?

@haverchuck
Copy link
Member

Closing this issue due to inactivity.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question General question
Projects
None yet
Development

No branches or pull requests

4 participants