Open5

AWS Amplify x React チュートリアルのつまずき

Backend のビルドでエラーが発生

File project: data should NOT have additional properties: 'graphqltransformer'
詳細なログ
# Starting phase: build
2021-09-20T07:59:17.114Z [INFO]: File project: data should NOT have additional properties: 'graphqltransformer'
2021-09-20T07:59:17.114Z [INFO]: JSONValidationError: File project: data should NOT have additional properties: 'graphqltransformer'
                                 at validator (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/feature-flags/featureFlags.js:136:27)
                                 at featureFlagsValidator (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/feature-flags/featureFlags.js:140:17)
                                 at FeatureFlags.validateFlags (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/feature-flags/featureFlags.js:146:17)
                                 at FeatureFlags.loadValues (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/feature-flags/featureFlags.js:204:18)
                                 at async Function.FeatureFlags.initialize (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/feature-flags/featureFlags.js:267:5)
                                 at async Object.run (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/index.js:73:9)
2021-09-20T07:59:17.119Z [ERROR]: !!! Build failed
2021-09-20T07:59:17.119Z [ERROR]: !!! Non-Zero Exit Code detected
2021-09-20T07:59:17.119Z [INFO]: # Starting environment caching...
2021-09-20T07:59:17.120Z [INFO]: # Uploading environment cache artifact...
2021-09-20T07:59:17.230Z [INFO]: # Environment caching completed
Terminating logging...

ローカルの Amplify CLI のバージョンが合致していないことが原因。
下記の手順で設定を行う

  1. サイドバーから App settings  → Build settings
  2. Build image settings → Edit
  3. App package version override
  4. Amplify CLI を選択
  5. Version は latest
  6. Save

redeploy を行うと Backend のビルドで別のエラーが発生

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

role が設定されていないようなので、設定する

  1. サイドバーから App settings → General
  2. App details → Edit
  3. Service role に設定
  4. role を作成していない場合は、 I AM より設定を行う
  5. AdministratorAccess-Amplify の Policy などで良いと思う
  6. Save
ログインするとコメントできます