I have an amplify project in React and I set up the front end pages already using React-Router etc.. and deployed on amplify and it was working great.
Now I want to add a backend so I ran:
npm create amplify@latest
it creates an amplify folder and creates amplify_outputs.json locally but when I try and deploy the latest commit I am getting a build error:
2024-10-03T15:49:01.443Z [INFO]: src/App.tsx(10,21): error TS2307: Cannot find module '../amplify_outputs.json' or its corresponding type declarations.
I see that amplify_outputs.json was added to the git ignore automatically but its not getting generated on the build so was wondering if I should remove it from the git ignore but it has a user_pool_client_id in it so Im pretty sure its supposed be generated on the build.
2
Answers
Hi I did have to add a amplify.yaml but through different testing this is what I needed:
amplify_outputs.json
should be in in.gitignore
since it can change as the environment or resources change.First ensure that the backend is correctly deployed by running
amplify push
thenamplify pull --appId APP_ID
to regenerate theamplify_outputs.json
file locally.If the above doesn’t work, try adding this to
amplify.yml
file: