Skip to content

Cannot find file '../aws-exports' #503

@trevorallred

Description

@trevorallred

Describe the bug
When I try to build my application remotely, it fails do to the following error:

2019-03-04T17:16:13.489Z [INFO]: $ react-scripts build
2019-03-04T17:16:14.796Z [INFO]: Creating an optimized production build...
2019-03-04T17:16:21.183Z [INFO]: Failed to compile.
2019-03-04T17:16:21.184Z [INFO]: ./src/pages/amplify.js
Cannot find file '../aws-exports' in './src/pages'.

To Reproduce
Steps to reproduce the behavior:

  1. Create a react js application
  2. Initialize the application with amplify init
  3. Notice init creates the src/aws-exports.js file and correctly adds it to the .gitignore file
  4. Add this code to your App.js file.
import Amplify from 'aws-amplify';
import aws_exports from '../aws-exports';
Amplify.configure(aws_exports);
  1. Run the application locally. It works correctly.
  2. Run amplify push
  3. Look at the Frontend build output and notice it fails to build

Expected behavior
To configure Amplify, the documentation explains that you should reference a file called aws-exports.js. This works fine locally because it's created locally. But when I commit the file and pull it from the repo, the build complains that it's not there. The docs don't explain where this file should be remotely and how you can refer to a file locally yet not check it in.

Additional Info
There seem to be some hints about what's happening in the Provisioning step

HEAD is now at 7b8a433... add environment var for api and fix index
2019-03-04T17:16:11.041Z [INFO]: Retrieving environment cache...

I think that remotely, it's adding in the aws-exports file somewhere but it's possible it's in a different location, which is why my import can't find the file.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions