I'm on the third module of this AWS tutorial to build a React app with AWS, Amplify and GraphQL but the build keeps breaking. When I ran amplify push --y
the CLI generated ./src/aws-exports.js
and added the same file to the .gitignore
. So I'm not surprised the build is failing, since that file isn't included when I push my changes.
So I'm not sure what to do here. Considering it's automatically added to the .gitignore
I'm hesitant to remove it.
Any suggestions?
aws-exports. This file is generated only for JavaScript projects. It contains the consolidated outputs from all the categories and is placed under the src directory specified during the init process. It is updated after amplify push . This file is consumed by the Amplify JavaScript library for configuration.
The error "could not find declaration file for module 'react'" occurs when TypeScript cannot find the type declaration for a react-related module. To solve the error install the types for the module by running the command from the error message, e.g. npm install -D @types/react .
The amplify pull command pulls down the latest backend environment to your local development. It is used in two scenarios: On projects already initialized by the Amplify CLI, it pulls down the latest from the Cloud and updates the contents in the amplify/#current-cloud-backend directory.
To manually deploy an app from Amazon S3 or a public URL Sign in to the AWS Management Console and open the Amplify console . At the top of the page, choose Get started. In the Deliver section, choose Get started. On the Host your web app page, choose Deploy without Git provider.
I'm assuming you are trying to build your app in a CI/CD environment? If that's the case then you need to build the backend part of your amplify app before you can build the frontend component.
For example, my app is building from the AWS amplify console and in my build settings I have
version: 0.1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install --frozen-lockfile
build:
commands:
- yarn build
artifacts:
baseDirectory: build
files:
- "**/*"
cache:
paths:
- node_modules/**/*
Note that the backend is building first with the amplifyPush --simple
command. This is what generates the aws-exports.js
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With