Closed16

AMPLIFY SNS WORKSHOP のドキュメントにプルリクエストを送る

murnanamurnana

AMPLIFY SNS WORKSHOP (https://amplify-sns.workshop.aws/ja/) はGitHub上で管理されているのか、何か問題を見つけたらIssueを立てたり、Pull Requestを送ることができます。

今回は「まんてらスタジオ」上で皆でこのワークショップをやろうぜ!とやってみたときに見つけ、解決した問題についてのPull Requestを送ってみようと思います。

発生した問題

2つあります。それぞれでプルリクエストを送るつもりです。

amplify push をしたときに権限が足りないと怒られる

原因となっているエラー文は以下です。

Resource Name: amplify-boyaki-143-UserPoolClientLambda-<なんかのID?>(AWS::Lambda::Function)
Event Type: create
Reason: Resource handler returned message: "User: arn:aws:iam::<AWSアカウント ID>:user/amplify-sns-workshop is not 
authorized to perform: lambda:TagResource on resource: arn:aws:lambda:us-east-1:<AWSアカウント ID>:function:amplify-boyaki-production-143-UserPoolClientLambda-a30FDtDOtXMb because no identity-based policy allows the lambda:TagResource action (Service: Lambda, Status Code: 403, Request ID: <リクエストID?>)" (RequestToken: <トークン>, HandlerErrorCode: AccessDenied)

原因

amplify-cliの設定 で、AdministratorAccess権限を持つIAMユーザーを作るのが嫌だったため、ドキュメントの案内に従って IAM ポリシーを作成していました。
しかし、そのポリシー内で「lambda:TagResource」の権限がないために発生していました。


npm ERR! peer react@"^16.7.0" from @aws-amplify/ui-react@0.2.34 対応後、フロントエンドのコンパイルが通らない

  1. MVPを作ろう > 3.1. Bootstrap > 認証機能での認証機能のフロントエンドへの実装 にて、npm ERR! peer react@"^16.7.0" from @aws-amplify/ui-react@0.2.34 が出たため、ドキュメントに従って書き換え、動作確認を行ったところ、ブラウザ上では真っ白になり、サインインの画面すら出なかった

原因

./src/index.js に書き込まれているソースコードが React v18.2.0での動作を想定しているため、ダウングレード後の React v16.8.0 では動作しませんでした。

murnanamurnana

早速Windows環境ゆえに詰んでる…Quick StartがmacOS環境前提だ…。

Chocolatey でのインストール があるので、Chocolateyを使っていれてみることに。

Chocolateyは入ってるかな?とchoco -vをたたく。0.10.15と返ってきた。おー。

murnanamurnana

管理者権限のコマンドプロンプト(最初、何もしないでコマンド打ったらだめでした)でインストール。

murnanamurnana

hugo help でヘルプが出てきたのでパスは通ってる様子です。
しかし hugo server を実行したら… いっぱいエラーが…

murnanamurnana

hugo v0.101.0
ってバージョン合ってないや…うーん、また今度…

murnanamurnana

うーん?開かない

[5721 ms] Remote-Containers 0.241.3 in VS Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630).
[5720 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[5837 ms] unable to resolve docker endpoint: open C:\Users\<ユーザー名>\.docker\machine\machines\default\ca.pem: The system cannot find the path specified.
murnanamurnana

一難去ってまた一難。

[208207 ms] error during connect: Get "https://<ipアドレス>:<ポート番号>/v1.24/version": dial tcp <ipアドレス>:<ポート番号>: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
murnanamurnana

https://github.com/aws-samples/aws-amplify-social-network-app-workshop/issues/5#issuecomment-1207738233 より

At first it looked like I needed to update the runtime environment, but as I researched the "Functions" in Lambda, I realized I was using Node instead of Python so I realized that there was some kind of issue with the push processes. Therefore, I ran a command to update the Amplify CLI: $ sudo npm i -g @aws-amplify/cli

ぬ?

murnanamurnana

なんやかんやで、staging-環境のバックエンドを構築 中…
お、なんかアラートが

We are contacting you as we have identified that your AWS Account currently has one or more Lambda functions using Node.js 12 runtime.

We are ending support for Node.js 12 in AWS Lambda. This follows Node.js 12 End-Of-Life (EOL) reached on April 30, 2022 [1].

As described in the Lambda runtime support policy [2], end of support for language runtimes in Lambda happens in two stages. Starting November 14, 2022, Lambda will no longer apply security patches and other updates to the Node.js 12 runtime used by Lambda functions, and functions using Node.js 12 will no longer be eligible for technical support. In addition, you will no longer be able to create new Lambda functions using the Node.js 12 runtime. Starting December 14, 2022, you will no longer be able to update existing functions using the Node.js 12 runtime.

We recommend that you upgrade your existing Node.js 12 functions to Node.js 16 before November 14, 2022.

End of support does not impact function execution. Your functions will continue to run. However, they will be running on an unsupported runtime which is no longer maintained or patched by the AWS Lambda team.

The following command shows how to use the AWS CLI [3] to list all functions in a specific region using Node.js 12. To find all such functions in your account, repeat this command for each region:

aws lambda list-functions --function-version ALL --region us-east-1 --output text --query "Functions[?Runtime=='nodejs12.x'].FunctionArn"

If you have any concerns or require further assistance, please contact AWS Support [4].

将来(2022/12/14以降?)は AWS Lamdaの Runtime: nodejs12.x が引っかかるのかも?

このスクラップは1ヶ月前にクローズされました