amplify push をしたらエラーが発生。
この記事を参考に問題を解決しました。
しかし、amplify add apiで別のエラーに引っかかる。
MacBook-Air:ampIAM ****$ amplify add api
? Please select from one of the below mentioned services: GraphQL
SyntaxError: Unexpected identifier
at serviceQuestions (/Users/******/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-api/provider-utils/awscloudformation/index.js:13:10)
at Object.addResource (/Users/******/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-api/provider-utils/awscloudformation/index.js:54:10)
at /Users/******/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-api/commands/api/add.js:24:35
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at async Object.executeAmplifyCommand (/Users/******/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-api/index.js:176:3)
There was an error adding the API resource
とのことなので、とりあえずNode.jsの更新を行います。
$ npm install -g n
$ n --stable
$ n --latest
$ n latest
sudoを求められた場合は、npm install -g nの実行結果にあるnのフルパスを使って下記のように書くと実行できます。
sudo フルパス latest
再度apiを作成。
✔ Generated GraphQL operations successfully and saved at graphql
✔ Code generated successfully and saved in file API.swift
✔ All resources are updated in the cloud
うまくいきました!
@aws-amplify/cliのアップデートを行った際は、対応のバージョンにnpm及びNode.jsのアップデートが必要になるようです。