Amplify hosting의 app framework 변경법

Amplify hosting의 app framework 변경법
Photo by Sander Weeteling / Unsplash

현재 재현 경로

  1. storybook 6.5 배포 잘 쓰고 있다가
  2. 어느 시점부터 해당 module project를 사용하는 app project들이 뒤늦게 next.js를 사용하기로 하여, next/link 등 부속 component를 쓰기 위해 next 의존성 설치 - 여전히 해당 module project는 next.js를 빌드하지 않음
  3. 기존 amplify hosting app 의 다음 빌드부터 갑자기 framwork가 React에서 Next.js - SSR로 변경되어, 배포 실패

아래 이슈에서 솔루션으로 소개되는 방법으로 해결을 맛봄

Change aws amplify application infrastructure ? · Issue #2042 · aws-amplify/amplify-hosting
Before opening, please confirm: I have checked to see if my question is addressed in the FAQ. I have searched for duplicate or closed issues. I have read the guide for submitting bug reports. I hav...

console의 UI 구조상, framework는 update-app으로 고쳐도 될 줄 알았는데, 아래처럼 안된다. update-branch로 합시다.

❱ aws amplify update-app --app-id d166xxxxxxxxxx --framework 'React'

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: --framework, React
❱ aws amplify update-branch --app-id d166xxxxxxxxxx --branch-name main --framework 'React'

혹시 platform이 WEB이 아닌 다른 것이어서 문제가 되는 것 같다면, 아래 내용을 참고해볼 것

❱ aws amplify update-app --app-id d166xxxxxxxxxx --platform WEB
update-app — AWS CLI 2.9.6 Command Reference