-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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:
- Create a react js application
- Initialize the application with
amplify init
- Notice init creates the src/aws-exports.js file and correctly adds it to the .gitignore file
- Add this code to your App.js file.
import Amplify from 'aws-amplify';
import aws_exports from '../aws-exports';
Amplify.configure(aws_exports);
- Run the application locally. It works correctly.
- Run
amplify push
- 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.