[Hosting] Amplify Build 이미지에서 amplify project 받기 - awskrug/kendra-button GitHub Wiki
현재 백엔드와 프론트엔드가 혼재해 있는 mono repo에선 Amplify Build Setting이 아주 까다롭다
특히 aws-exports.js파일의 경로를 찾지 못하는 경우가 발생되는데,
Module not found: Can't resolve '../aws-exports' in '/codebuild/output/src380284122/src/kendra-button/frontend/kendra-button-front/src/pages'
amplify.yml 세팅
이럴 땐 특정 폴더를 들어가서 amplify의 환경을 받아오는 스크립트가 필요하다... 그런데 이렇게 알아보면서 굳이 이런 수고스러운 세팅을 왜 해야 하나 라는 불만이 넘쳤다.
amplifyPush 스크립트 사용
amplifyPush --environment dev
- 이후 빌드 시 콘솔 내 에러
Your app does not have a role and you're attempting to interact with AWS resources
In order for you to interact with AWS resources you need to attach a role to your app. This can be done in the General Settings page in the console
- 빌드 이미지 내에서의 주요 에러
Error: AWS access credentials can not be found.
- IAM에서 직접 Role 생성 후 Amplify General setting에 생성한 Role 붙이기: 여기서부터 정말 맘에 안듦..
ampliyPush 스크립트 동작
amplifyPush --environment dev
- Amplify 빌드 이미지 내에서 이 명령이 실행되면, 새로운 amplify 리소스가 CloudFormation를 통해서 새로 생성된다..
- 그러다가 자체적으로 에러가 나온다..
- UpdateRolesWithIDPFunction: The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 1e17a1bb-87d9-4ba4-b330-edb071157b10)
지금까지 무작정 따라했는데, 보니까 백엔드 배포를 위한 스크립트를 하고 있었다.
나는 이미 백엔드 배포를 완료 했고, 빌드 이미지 안에 amplify pull 을 통해서 숨겨진 amplify 프로젝트를 받아오기만 하면 된다..
amplify 빌드 이미지에서 amplify pull 을 인식하지 못했던 기억을 되살려서..
Build Image setting에서 Amplify CLI 패키지를 추가했다.
...
10분이 지나도 멈춰있길래 실패한듯 하다.
그래서 Amplify Discord에 질문을 올렸다. 반응이 없었다.
그래서 삽질한 내역을 정리해서 amplify-console의 issue에 올렸고, 시간이 지나 자체 amplify pull 쉘스크립트를 통해서 amplify의 내용을 받아올 수 있었다.
- 그에 대한 내용은 여기서 확인 가능.
해당 리포의 Wiki에도 남겼다.