2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS Lambdaでlib64/libc.so.6: version `GLIBC_2.28' not foundの対応

Posted at

状況

terraform-aws-modules/terraform-aws-lambda で APIのAuthorizerをデプロイしようとして、pyjwt[crypto] でID Tokenを検証しようとしたら、そもそもpyjwtのインポートでエラーが発生。

[ERROR] Runtime.ImportModuleError: Unable to import module 'authorizer': /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so)

コード構成

├── code
│   ├── authorizer.py
│   ├── poetry.lock
│   └── pyproject.toml
└── main.tf
module "authorizer_lambda" {
  source  = "terraform-aws-modules/lambda/aws"
  version = "6.0.1"

  function_name = local.function_name
  handler       = "authorizer.handler"
  runtime       = local.runtime

  source_path = [
    "${path.module}/code",
  ]
}

原因

エラーメッセージの通り、 GLIBC_2.28 が存在しない。もっと言えば /var/task/cryptography/hazmat/bindings/_rust.abi3.so があればいけそう。

対応

# _rust.abi3.soを含んだパッケージを取得
$ pip install --platform manylinux2014_x86_64 --implementation cp  --only-binary=:all: --upgrade --target temp/ cryptography

# 該当のディレクトリを作成
$ mkdir -p cryptography/hazmat/bindings

# pipで準備した_rust.abi3.soをコピー
$ cp -ai temp/cryptography/hazmat/bindings/_rust.abi3.so cryptography/hazmat/bindings/

# pipのパッケージは不要なので削除
$ rm -fR ./temp

# cryptography/hazmat/bindings/_rust.abi3.soが準備できました
$ tree cryptography/
cryptography/
└── hazmat
    └── bindings
        └── _rust.abi3.so

あとはTerraform Applyをすれば、pyjwt[crypto] でID Tokenを検証ができるようになっています。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?