> For the complete documentation index, see [llms.txt](https://gwen-leigh.gitbook.io/free-aws-cloud-project-bookcamp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gwen-leigh.gitbook.io/free-aws-cloud-project-bookcamp/week-3-decentralised-authentication/bug-fix-export-auth-imported-as-auth-was-not-found-in-aws-amplify.md).

# Bug Fix: export 'Auth' (imported as 'Auth') was not found in 'aws-amplify'

## 1. Problem

<div data-full-width="true"><figure><img src="https://2555313172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSUTvba76C6ObDoYtcvGJ%2Fuploads%2FWCO8lv5HgPbqkvmIJWQa%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202023-11-19%20140323.png?alt=media&amp;token=03bc6731-b293-4979-8235-79a0b94d78c9" alt=""><figcaption></figcaption></figure></div>

* **line 8**: even though the code is there, the frontend container would still through the `undefined` error:&#x20;

{% code title="HomeFeedPage.js" lineNumbers="true" %}

```javascript
   const checkAuth = async () => {
    Auth.currentAuthenticatedUser({
      bypassCache: false
    })
    .then((user) => {
      console.log('user', user);
      return Auth.currentAuthenticatedUser()
    }).then((cognito_user) => {
      setUser({
        display_name: cognito_user.attributes.name,
        handle: cognito_user.attributes.preferred_username
      })
    })
    .catch((err) => console.log(err));
  }
```

{% endcode %}

## 2. Analysis

* It turns out, the upgraded version of `Amplify` was out. It's been more than 6 months since this Week 3 phase of development was out. As I'm starting all over again, I automatically got the latest version of 6.x.x when I ran `npm i`.

## 3. Solution

* [ ] Use the specific version Andrew used (`5.x.x`):

```diff
-    "aws-amplify": "^6.0.2",
+    "aws-amplify": "^5.0.16",
```

## 4. Result

* Amplify works correctly so throws the corresponding error correctly in the frontend.&#x20;
  * The Dev console error was gone.

<figure><img src="https://2555313172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSUTvba76C6ObDoYtcvGJ%2Fuploads%2FcFQkAZQTJxenrelzHKKV%2Fimage.png?alt=media&amp;token=b0191ba7-1449-4325-92f3-aa563a3c7642" alt=""><figcaption></figcaption></figure>
