Software

最新コメント

Copilot Studioのニュースや記事

wakairo @wakairo

ちなみに、著者の方は「マイクロソフトのエンジニア」だそうです。

仕事半分趣味半分でエンジニアをやっています。 正体はマイクロソフトのエンジニアです。しかし、こちらで配信している内容は個人の趣味活動のため、マイクロソフトとは一切関係ありませんし、サポートの対象外でございます。

1
Raw
https://www.techtips.page/ja/comments/214
😄1

rails 7.0からrails 7.1への移行(アップデート、アップグレード)で必要な作業

wakairo @wakairo

基本的にはRailsガイドの手順に従えば良いと思います。

ガイドの手順にもありますが、ぜひbin/rails app:updateコマンドを活用しましょう。

bin/rails app:updateコマンドの実行例

# bin/rails app:update
   identical  config/boot.rb
       exist  config
    conflict  config/application.rb
Overwrite /x/techtips/config/application.rb? (enter "h" for help) [Ynaqdhm] h
        Y - yes, overwrite
        n - no, do not overwrite
        a - all, overwrite this and all others
        q - quit, abort
        h - help, show this help
        d - diff, show the differences between the old and the new
        m - merge, run merge tool
Overwrite /x/techtips/config/application.rb? (enter "h" for help) [Ynaqdhm]
       force  config/application.rb
   identical  config/environment.rb
       exist  config/environments
    conflict  config/environments/development.rb
Overwrite /x/techtips/config/environments/development.rb? (enter "h" for help) [Ynaqdhm]
       force  config/environments/development.rb
    conflict  config/environments/production.rb
Overwrite /x/techtips/config/environments/production.rb? (enter "h" for help) [Ynaqdhm]
       force  config/environments/production.rb
    conflict  config/environments/test.rb
Overwrite /x/techtips/config/environments/test.rb? (enter "h" for help) [Ynaqdhm]
       force  config/environments/test.rb
       exist  config/initializers
    conflict  config/initializers/assets.rb
Overwrite /x/techtips/config/initializers/assets.rb? (enter "h" for help) [Ynaqdhm]
       force  config/initializers/assets.rb
    conflict  config/initializers/content_security_policy.rb
Overwrite /x/techtips/config/initializers/content_security_policy.rb? (enter "h" for help) [Ynaqdhm]
       force  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
    conflict  config/initializers/filter_parameter_logging.rb
Overwrite /x/techtips/config/initializers/filter_parameter_logging.rb? (enter "h" for help) [Ynaqdhm]
       force  config/initializers/filter_parameter_logging.rb
   identical  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_1.rb
    conflict  config/initializers/permissions_policy.rb
Overwrite /x/techtips/config/initializers/permissions_policy.rb? (enter "h" for help) [Ynaqdhm]
       force  config/initializers/permissions_policy.rb
      remove  config/initializers/cors.rb
       exist  bin
   identical  bin/rails
   identical  bin/rake
    conflict  bin/setup
Overwrite /x/techtips/bin/setup? (enter "h" for help) [Ynaqdhm]
       force  bin/setup
       rails  active_storage:update
Copied migration 20231128024504_add_service_name_to_active_storage_blobs.active_storage.rb from active_storage
Copied migration 20231128024505_create_active_storage_variant_records.active_storage.rb from active_storage
Copied migration 20231128024506_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb from active_storage

After this, check Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html for more details about upgrading your app.
0
Raw
https://www.techtips.page/ja/comments/213

Copilot Studioのニュースや記事

copilot こぱいろっとスキー @copilot
最終更新
0
Raw
https://www.techtips.page/ja/comments/209
😄1

Copilot Studioのニュースや記事

copilot こぱいろっとスキー @copilot
最終更新
0
Raw
https://www.techtips.page/ja/comments/208
😄1

closure_treeはRailsのfixturesには未対応の模様

wakairo @wakairo

closure_treeは、現在のところfixturesと組み合わせて利用されることが想定されていないようです。
と言うのも、closure_tree gemを利用したRails 7のappのtestにおいて、fixturesを用いているのですが、いくつか困った現象に遭遇しているためです。

開発で困っている現象

具体的には、以下のような現象に遭遇しています。

現在の対応策

これらの現象は、test中でcreateメソッド等を使用して作成したオブジェクトでは発生しません。
そこで前述の現象に対応するため、closure_treeを利用しているモデルでは、create等のメソッドでオブジェクトを作成し、testに用いています。
なお、小手先のテクニックとして、fixturesで記述したテスト用初期設定を、createで作ったオブジェクトに移し替える処理を書くという方法があります。こうすることで、テスト用初期設定はfixturesに書きつつも、困った現象は回避することが出来ます。

0
Raw
https://www.techtips.page/ja/comments/207

Stimulusの記事の情報が集まるTopic

wakairo @wakairo
最終更新

Stimulusには、Targetに、Valueに、Action Parameterにと、HTML側からJavaScript側へ何かしらを引き渡す仕組みがいろいろとあります。ですので、これら3つの仕組みについてサンプルコードを交えて説明する記事を書きました。

0
Raw
https://www.techtips.page/ja/comments/206

Stimulusの記事の情報が集まるTopic

wakairo @wakairo

公式ドキュメント(英語)

公式情報がしっかりしているので、まず読むならこれら公式情報でしょうが、英語なのが日本人にはちょっと大変。

0
Raw
https://www.techtips.page/ja/comments/205
😄8

AWS Amplifyを使ったSlackbotの開発

YamaKawa @YamaKawa
最終更新

※書き途中の内容です。

問題

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+に変更

次に発生したエラー

[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は1.24.4を入れて解決

別に発生したエラー

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

→以下の手順で解決

  1. pipenvでインストールしたパッケージを記録
  2. pipenvでインストールしたパッケージをアンインストール
  3. 1.で記録したパッケージを元にLambdaレイヤー作成

■レイヤーの作り方

  1. Lambdaで「レイヤー」選択
  2. レイヤーの作成
  3. 対象zipアップロード
  4. x84_64選択
  5. ランタイム:python3.8選択
  6. 対象関数で「レイヤーの追加」ボタン押下
  7. カスタムレイヤーで作ったレイヤー選択
0
Raw
https://www.techtips.page/ja/comments/203
😄1