amplify ビルド時のエラー
git clone した後に、npm run buildした際に以下のようなエラーが出た。
[ ] info - Generating static pages (0/17)[ERROR] 09:36.824 AuthError -
Error: Amplify has not been configured correctly.
The configuration object is missing required auth properties.
This error is typically caused by one of the following scenarios:
1. Did you run `amplify push` after adding auth via `amplify add auth`?
See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information
2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.
エラー
Error: No current user
原因は、.envを作ったのに、.envを.gitignoreでgitの管理から外していたため、.envがないので上記のようなエラーが発生した。
動作環境
amplify
next.js
感想
このエラーは、amplifyにおいて、現段階で.envに描いておくような内容は、開発時にどのようにして管理すべきか、デプロイの際にどのようにしていると合理的になるのかがわかっていない状態で起きたエラーです。
感想2
この状態でデプロイしたらビルドで失敗しました。
.envを.gitignoreから削除したら、デプロイのビルドに成功しました。