1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

The spiciness of Amplify Gen 2: CloudFormation

Posted at

Amplify Gen 2 ( Amplify ) について。

ここ数日悩まされてきたことについて記載する。

tl;dr

  • 1 つの方法で解決できず、エラー内容を見ながら、次の方法を探すと言う感じで解決した。
  • Ampify は最近 GA されたばかりのサービスで、未知の障害があることは想定されていた。
  • サポートも有効な回答を持ち合わせておらず、誰に頼るわけでもなく、自分でどうにかしなければならないため、非常に辛い。

突然 deploy できなくなる

  • 事象
    • Amplify Console からアプリを新しく作成した。backend.ts の変更はない。
    • npx ampx pipeline-deploy の実行が失敗。
    • アプリの再作成や CodeBuild の再設定でも効果なし。
  • 原因
    • 不明。
  • 対処方法
    1. CloudFormation スタックの CDKToolkit を削除。 1
    2. S3 から cdk-hnb659fds-assets-MY_ACCOUNT_ID-MY_REGION を削除。 1
    3. ECR から cdk-hnb659fds-container-assets-MY_ACCOUNT_ID-MY_REGION を削除。
    4. CloudShell を使用して、スタック CDKToolkit を手動で更新。 2 3
CodeBuild
[DEBUG] 2024-07-03T02:55:17.599Z: CloudFormationDeploymentError: The CloudFormation deployment has failed.
    at CdkErrorMapper.getAmplifyError (file:///codebuild/output/src1576062997/src/github.com/myorg/sample-app/node_modules/@aws-amplify/backend-deployer/lib/cdk_error_mapper.js:39:19)
    at CDKDeployer.tryInvokeCdk (file:///codebuild/output/src1576062997/src/github.com/myorg/sample-app/node_modules/@aws-amplify/backend-deployer/lib/cdk_deployer.js:166:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CDKDeployer.deploy (file:///codebuild/output/src1576062997/src/github.com/myorg/sample-app/node_modules/@aws-amplify/backend-deployer/lib/cdk_deployer.js:63:30)
    at async Object.handler (file:///codebuild/output/src1576062997/src/github.com/myorg/sample-app/node_modules/@aws-amplify/backend-cli/lib/commands/pipeline-deploy/pipeline_deploy_command.js:41:9)
[DEBUG] 2024-07-03T02:55:17.599Z: Error: ❌ Deployment failed: Error: Failed to publish asset c5839853d1235553bec66df2f4f850090e151c312cacd1c076d2ead4371423f7:current_account-current_region
CodeBuild
amplify-zzzzzzzz-HOGE423-branch-xxxxxxxx: creating CloudFormation changeset...
[DEBUG] 2024-07-03T23:47:03.910Z: 
 ❌  amplify-zzzzzzzz-HOGE423-branch-xxxxxxxx failed: Error [ValidationError]: Stack:arn:aws:cloudformation:ap-northeast-1:999999999999:stack/amplify-zzzzzzzz-HOGE423-branch-xxxxxxxx/e94ff1f0-398c-11ef-888e-0683abde6eb1 is in DELETE_FAILED state and can not be updated.
    at Request.extractError (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:46692)
    at Request.callListeners (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:91600)
    at Request.emit (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:91048)
    at Request.emit (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:199651)
    at Request.transition (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:193203)
    at AcceptorStateMachine.runTo (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:158075)
    at /codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:158405
    at Request.<anonymous> (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:193495)
    at Request.<anonymous> (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:199726)
    at Request.callListeners (/codebuild/output/src519137994/src/github.com/myorg/sample-app/node_modules/aws-cdk/lib/index.js:401:91768) {
  code: 'ValidationError',
  time: 2024-07-03T23:47:03.907Z,
  requestId: '0d381bf8-0c69-4080-a626-e5f278c4c92b',
  statusCode: 400,
  retryable: false,
  retryDelay: 425.126946062091
}

Conclusion

現職の試用期間が終了した。

MVV は非常に共感する部分であり、VALUE は自分が信条としていることと重なっているため、やりにくさはない。

一方で、他の会社と同様に、一部で出社を前提とした設計が始まっており、疑問点がある。

非同期コミュニケーションのサービスを提供する会社から BPaaS の会社へと変貌していることが要因だと思う。

しかし、個人的には通勤時間に対する抵抗感が大きい。

  1. https://qiita.com/wagasa2/items/882183e0360b76d79b5e 2

  2. https://zenn.dev/shimo_s3/articles/fd2330869236fe

  3. https://docs.amplify.aws/react/build-a-backend/troubleshooting/stack-cdktoolkit-already-exists/

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?