Amplifyで作成したプロジェクトでamplify pushを使ってデプロイしたLambdaを実行すると[ERROR] Runtime.ImportModuleError: Unable to import module 'index': urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fipsというエラーが発生する。
amplify pushでLambdaをデプロイしたところ、[ERROR] Runtime.ImportModuleError: Unable to import module 'index': urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fipsというエラーが発生
解決策
OpenSSLのバージョンを1.1.1+に変更
次に発生したエラー
[ERROR] Runtime.ImportModuleError: Unable to import module 'index': urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips
→ pip install urllib3で解決
次に発生したエラー
[ERROR] Runtime.ImportModuleError: Unable to import module ‘index’:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from “/var/lang/bin/python3.8”
* The NumPy version is: “1.24.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named ‘numpy.core._multiarray_umath’
Traceback (most recent call last):
→ 多分numpyを入れて解決
別に発生したエラー
The following resources failed to deploy:
Resource Name: LambdaFunction (AWS::Lambda::Function)
Event Type: update
Reason: Resource handler returned message: "Unzipped size must be smaller than 135390475 bytes (Service: Lambda, Status Code: 400, Request ID: a3b51e9a-4734-435e-a001-2c7ce1301ee7)" (RequestToken: 92a2a218-8b38-6b12-baff-133e7d710537, HandlerErrorCode: InvalidRequest)
URL: https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/arn%3Aaws%3Acloudformation%3Aap-northeast-1%3A237156174022%3Astack%2Famplify-slackbottesttwo-dev-162215-functionslackLangchainResponder-1PUTGEZ3KV53F%2F6707b020-344c-11ee-a124-0e162f03cf95/events
情報ありがとうございます。Itemの名前を更新しました。ちなみに、説明も古くなっていましたので、更新しました。
「Bing Chat」は、「Copilot」にリブランドということで、公式名称が「Copilot」に変わったようです。ですので、こちらのItem名も変更した方が良いかもしれません。
情報ソース:https://www.itmedia.co.jp/news/articles/2311/16/news080.html
Copilot Studioの発表と公開を伝える記事
closure_treeは、現在のところfixturesと組み合わせて利用されることが想定されていないようです。
と言うのも、closure_tree gemを利用したRails 7のappのtestにおいて、fixturesを用いているのですが、いくつか困った現象に遭遇しているためです。
開発で困っている現象
具体的には、以下のような現象に遭遇しています。
foos(:one).self_and_descendant_ids #=> []
(少なくともselfのIDが含まれるはずなので、空の配列はおかしい)現在の対応策
これらの現象は、test中でcreateメソッド等を使用して作成したオブジェクトでは発生しません。
そこで前述の現象に対応するため、closure_treeを利用しているモデルでは、create等のメソッドでオブジェクトを作成し、testに用いています。
なお、小手先のテクニックとして、fixturesで記述したテスト用初期設定を、createで作ったオブジェクトに移し替える処理を書くという方法があります。こうすることで、テスト用初期設定はfixturesに書きつつも、困った現象は回避することが出来ます。
Stimulusには、Targetに、Valueに、Action Parameterにと、HTML側からJavaScript側へ何かしらを引き渡す仕組みがいろいろとあります。ですので、これら3つの仕組みについてサンプルコードを交えて説明する記事を書きました。
公式ドキュメント(英語)
公式情報がしっかりしているので、まず読むならこれら公式情報でしょうが、英語なのが日本人にはちょっと大変。
※書き途中の内容です。
問題
Amplifyで作成したプロジェクトでamplify pushを使ってデプロイしたLambdaを実行すると
[ERROR] Runtime.ImportModuleError: Unable to import module 'index': urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips
というエラーが発生する。そもそも実現したいこと
LambdaでLangChainを使ってPineconeからフロントで入力された質問に対する回答をフロントに返したい。
行った手順
amplify pushでLambdaをデプロイしたところ、
[ERROR] Runtime.ImportModuleError: Unable to import module 'index': urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips
というエラーが発生解決策
OpenSSLのバージョンを1.1.1+に変更
次に発生したエラー
→ pip install urllib3で解決
次に発生したエラー
→ 多分numpyを入れて解決
別に発生したエラー
→Lambdaレイヤーを作って解決
コメントの領域(元から別のリンクが設定されている部分を除く)をクリックすることでそのコメントのページにジャンプできるようにしました。 この機能追加に伴って"Link to this comment"ボタンは消しましたので、今後はこのクリックによるコメントページへのジャンプをご利用ください。