Closed bholbrook73 closed 4 years ago
@bholbrook73 do your repo hasaws-exports
in that location? It is not git ignored? This is definitely not an issue with amplify. it looks like your aws exports
isn't being referenced right. In any case, you can always configure the info manually.
Like copy the aws-exports
object value and configure it using
Amplify.configure(
//paste the aws-exports value here
);
If you still have an issue, ping here and I will reopen the issue.
@ashika01 Thank you - yes, it was gitignored.
Is it a good solution to add the aws-exports file to github? Is there not data which should be secured and not pushed to the repo? Maybe is it possible to configure this properties directly into the amplify console?
You shouldn't be adding the aws-exports.js file to the repo because if you chose to deploy to a different environment then all the settings will be wrong for that environment. As I understand it AWS Amplify will automatically create this file for you when it runs the deploy process, depending on the environment you have chosen.
Also you appear to be referencing the path '/src/components/aws-exports' when it will be created in the 'src/' folder by Amplify CI/CD.
Nevertheless this file does not appear to be created at the moment as I can getting the same error.
I'm having the same issue trying to deploy my project using amplify console, the aws-exports file is git-ignored because it contains the values for each of the developers using it locally. What is the correct way to set up an amplify project in the console? If I deploy it from the command line, I can't set it up for CD in the console.
Has there been any updates to this? Encountering the same issue. Only way around I can see is having branch based aws-export files. Unless you are developing have specific deployment branches that can never be reconciled from master, there doesn't seem to be a way to do this currently.
I am also having the same problem with the was-exports file not being found but I checked all of it it is all in the correct directory.
Here is my log error:
Cannot find file './aws-exports' in './src'. 2021-04-01T03:02:40.021Z [WARNING]: npm 2021-04-01T03:02:40.021Z [WARNING]: ERR! code ELIFECYCLE npm ERR! errno 1 2021-04-01T03:02:40.023Z [WARNING]: npm 2021-04-01T03:02:40.023Z [WARNING]: ERR! hoa-plus-amplify@0.1.0 build:
react-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the hoa-plus-amplify@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 2021-04-01T03:02:40.061Z [WARNING]: 2021-04-01T03:02:40.061Z [WARNING]: npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-04-01T03_02_40_023Z-debug.log
Hey all, I think I found the problem.
Take a look at your AWS Amplify Console, and go to App Settings > Build Settings. Ensure that the following is present in the ``` build.yml file:
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
For whatever reason, this was missing from my build.yml file. Adding it should get you at least one step further! This configuration change is referenced (read: Hidden) here: https://aws.amazon.com/getting-started/hands-on/build-react-app-amplify-graphql/module-three/
I am still having the same problem.. Here is my build file: version: 1 frontend: phases: preBuild: commands:
@SaiCharan21 Try to flip the order of the two. You need to build the backend before building the frontend. Check the example shown in the URL I posted earlier as well, they list their backend before the frontend in the build.yml file. Here's mine as well for reference. PLEASE NOTE - I am using expo CLI, do not copy mine verbatim. Just use it for reference on the structure of the file
version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm install
- nvm use 10
- npm install --silent --global expo-cli
- |-
if [ -f yarn.lock ]; then
yarn
elif [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
npm ci
else
npm install
fi
build:
commands:
- 'expo build:web'
artifacts:
baseDirectory: web-build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- $(npm root --global)/**/*
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Describe the bug
The build in Amplify fails with error message "Cannot find file '../aws-exports' in './src/components'."
This works locally with
npm run build
and I'm able to access the API using the aws_exports locally.amplify push
works as expected without issue.When pushing to the repo and triggering a build, the build fails on all branches.
To Reproduce Push a change to any branch in Amplify App
arn:aws:amplify:us-east-1:958024423534:apps/d121a0czlswxc1
Expected behavior Expect app to build without error
Code Snippet Folder structure:
src/ components/ Quote.tsx awx-exports.js
Quote.tsx imports:
What is Configured?
aws-exports:
If applicable, please provide what is configured for Amplify CLI:
aws-exports
file:Additional context Logs of build