LoginSignup
0
0

More than 1 year has passed since last update.

amplify push のエラーと戦う

Last updated at Posted at 2022-11-16

ブランチを切り替えた時に、切り替え前に作成したlambda funtionがローカルのコードから消えてpushするパターン

症状

error1

CloudFormation template is missing in the resource directory
/Users/xxxx/Documents/xxxxx/xxxxx/amplify/backend/function/functionXの名前

不要になっている/Users/xxxx/Documents/xxxxx/xxxxx/amplify/backend/function/functionXが残ってないか確認する

error2

Resource is not in the state stackUpdateComplete

このときに
Backend environments>アクション>詳細>最新のデプロイアクティビティを確認(ここはエラーになったら見た方が良い)
UPDATE_FAILEDを探すと

2022/11/15, 23:21:29	functionYの名前 (function)	| UPDATE_FAILED|Parameters: [functionXの名前] do not exist in the template

がある

原因

  • Aブランチ
    • functionX追加
    • 元々あるfunctionYがfunctionXを利用する
    • 開発を完了(AWSにpush済み)
  • 別の修正をするためにBブランチを作る
    • ブランチからfunctionXは存在しなくなる。
    • amplify pushするとエラーになる

解決方法

amplifyの環境にfunctionXが残っていてさらにfunctionY→functionXの依存関係が残っているので以下の手順を行えばpushできる

  • Bブランチでamplify pull
  • functionYがfunctionXを利用する関係を切る
  • functionXを削除する(依存関係を切らないで削除するとエラーになる)amplify remove function
  • amplifi push
  • Bブランチをコミットまで戻す
  • amplifi push

全部のlambda functionを消して、pushするのが早いかも。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0