20240723

暗黙の優先順位

Cognito のためにクライアントを作成する時に dotenv を使用して 認証情報を Rails アプリに ロードしているのにそちらを使わずに aws configure sso の値を使っているために IAM Identity Center(sso) のセッションが切れると Aws::Errors::InvalidSSOToken になってしまっていた。

screenshot of rails error message

これは AWS SDK が認証情報を参照する優先順位として、まずホームディレクトリにある ~/.aws/{config,credentials} を 優先してチェックしてしまうからだった。AWS_SDK_CONFIG_OPT_OUT=true にしておけばこの問題は解決する。 fly.io では発生しないだろうし、こういう環境依存の問題が最もわかりにくい。

The shared config file is not checked if the environment
variable AWS_SDK_CONFIG_OPT_OUT is set.

https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html

2024-07-23 22:01:55 +0900 +0900


Next
Previous

anime 3
api 1
aws 3
cloudflrare 1
cognito 1
development 1
development process 1
development standard 1
game 1
howto 2
hugo 1
idea 2
impressed 1
leaning toothpick syndrome 1
life 6
log 2
maxim 2
mdx 1
postgresql 2
rails 7
rubocop 1
ruby 1
rust 1
solution 2
stripe 1
tech 17
ui 1
warp 1