September 29, 2022 / Reading time: 2 minutes

[Solution] AWS Amplify: Cannot find file './aws-exports'

Solution tl;dr

If you are using AWS Amplify and you are getting an error like this:

Unable to resolve "./aws-exports" from "App.js"
# or
Cannot find file './aws-exports'.

All you need to do is use @aws-amplify/cli to pull that file from the cloud, like this:

amplify env pull --restore

Make sure you have:

  • @aws-amplify/cli installed and configured
  • AWS credentials are set up
  • You're using the right set of AWS credentials and you're targeting correct region (where the Amplify project is deployed)
  • You're importing the aws-exports file with the right path (e.g. App.js)

Alternatively, you can use amplify push but it will also push your local changes to the cloud.


This is a common error when you are using AWS Amplify and you are trying to run your app locally on a new machine. It's a bit misleading because it's not really a problem with the file itself, but rather with the fact that you might be importing a config file that's missing.

Because it is not advised to push this file to the repository (it contains sensitive variables so by default it's listed inside .gitignore), you need to pull it from the cloud. You can do it with amplify env pull --restore command.

What is aws-exports.js file?

aws-exports.js file This file is generated for JavaScript/TypeScript projects that are using AWS Amplify. It contains the consolidated outputs from all the categories, such as Auth, API, Hosting, etc., and is placed under the src directory that the developer specified during the amplify init process.

Grep through your AWS Console. Fast.

Was that in us-east-1? Or us-west-2? No need to remember. Just type the name of the resource and CloudTempo will find it.