title: Getting AWS cognito authenticated user in post-authentication lambda trigger
body: <p>I'm using Amplify with the Cognito backend to authenticate my users, essentially as an LDAP impl. This is all configured and working just fine. The users are setup in the user pool, and authenticated properly. (Note: I'm using the default Amplify controls, so it works as expected).</p>
  <p>However, now I want to be able to pull the authenticated user and all of their data (including user attributes) so that I can update the user. As a first step, I'm trying to log the authenticated user to the console. Eventually I'll use this hook to update the user attributes by pulling some data from the DB for an update.</p>
  <p>This is the code snippet I'm trying to use</p>
  <pre><code>exports.handler = async (event, context, callback) =&gt; {
  
      const Amplify = require('@aws-amplify/core')
      const Auth = require('@aws-amplify/auth')
  
      console.log(&quot;Amplify object: %o&quot;, Amplify)
      console.log(&quot;Auth object: %o&quot;, Auth)
  
      Amplify.configure({
          Auth: {
                  identityPoolId: 'XXXX',
                  region: event.region,
                  userPoolId: event.userPoolId
          }
      });
      
      console.log(&quot;about to get current user&quot;);
      Auth.currentAuthenticatedUser().then(user =&gt; console.log(user));
      console.log(&quot;got current user and logged&quot;);
  }
  </code></pre>
  <p>And here are a couple snippets of the output ...</p>
  <pre><code>INFO    Amplify object: {
    [__esModule]: true,
    Amplify: [Function: Amplify] {
      [length]: 0,
      [name]: 'Amplify',
      [prototype]: Amplify { [constructor]: [Circular] },
      register: [Function] {
        [length]: 1,
        [name]: '',
        [prototype]: { [constructor]: [Circular] }
      },
      configure: [Function] {
        [length]: 1,
        [name]: '',
        [prototype]: { [constructor]: [Circular] }
      },
      addPluggable: [Function] {
        [length]: 1,
        [name]: '',
        [prototype]: { [constructor]: [Circular] }
      },
      _components: [
  </code></pre>
  <p>and</p>
  <pre><code>INFO    Auth object: {
    [__esModule]: true,
    Auth: AuthClass {
      userPool: null,
      user: null,
      oAuthFlowInProgress: false,
      currentUserCredentials: [Function: bound ] { [length]: 0, [name]: 'bound ' },
  </code></pre>
  <p>and the error I receive is:</p>
  <pre><code>ERROR   Invoke Error    
  {
      &quot;errorType&quot;: &quot;TypeError&quot;,
      &quot;errorMessage&quot;: &quot;Amplify.configure is not a function&quot;,
      &quot;stack&quot;: [
          &quot;TypeError: Amplify.configure is not a function&quot;,
          &quot;    at Runtime.exports.handler (/var/task/index.js:171:13)&quot;,
          &quot;    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)&quot;
      ]
  }
  </code></pre>