rust-serverless / lambda-rust

🐳 🦀 a dockerized lambda build env for rust applications
MIT License
34 stars 8 forks source link

`/lib64/libc.so.6: version 'GLIBC_2.18' not found` on Lambda #35

Closed chrg1001 closed 2 years ago

chrg1001 commented 2 years ago

Maybe this repository is not the right place to raise this issue.

I am using rust-serverless/serverless-rust with this repo's docker image to deploy my rust project to lambda.

It was successfully deployed , but I got this error at runtime. (the same issue on awslabs/aws-lambda-rust-runtime/issues/17 )

/var/task/bootstrap: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /var/task/bootstrap)

When I checked the Lambda runtime setting on the AWS Console, it was set to ”Custom runtime".

image

I changed the Runtime setting to "Custom runtime on Amazon Linux 2" directly on the AWS Console, and it worked fine.

image

Is there any way to set this up for deploy timing?


Cargo.toml

[package]
name = "demo"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1.14", features = ["macros"] }
lambda_http = "0.4"
lambda_runtime = "0.4"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
mongodb = "2.0"
once_cell = "1.8"
envy = "0.4"
futures = "0.3"

[[bin]]
name = "hello"
path = "src/bin/hello.rs"

serverless.yaml

service: demo

provider:
  name: aws
  runtime: rust
  memorySize: 128
  lambdaHashingVersion: 20201221
  stage: dev
  profile: demo
  region: ap-northeast-1

custom:
  rust:
    # flags passed to cargo
    # cargoFlags: '--features enable-awesome'
    # custom docker tag
    dockerTag: latest
    # custom docker image
    dockerImage: rustserverless/lambda-rust
package:
  individually: true
plugins:
  - serverless-rust
functions:
  hello:
    handler: demo.hello

package.json

{
  "name": "demo",
  "version": "0.0.1",
  "devDependencies": {
    "serverless": "^2.69.0",
    "serverless-rust": "^0.3.8"
  }
}

Environment

OS : Windows 11 Node version : 14.16.1 Serverless Framework Version : 2.69.0

zamazan4ik commented 2 years ago

Not familiar enough with Serverless but for now seems like you need to configure somehow the right Runtime env during the deployment. This repo has nothing with your deploy process.

chrg1001 commented 2 years ago

@zamazan4ik Thanks for your reply.

I read the source code of rust-serverless/serverless-rust and found the solution for this.

"serverless-rust": "^0.3.8" uses original repo softprops/serverless-rust of rust-serverless/serverless-rust, and this issue has been fixed after v0.3.8 (this commit, not tagged).

In conclusion, the solution is updating package.json like below at the moment.

P.S. Sorry, this is an unrelated issue to this repository.

{
  "name": "demo",
  "version": "0.0.1",
  "devDependencies": {
    "serverless": "^2.69.0",
    // The latest commit at this time
    "serverless-rust": "https://github.com/softprops/serverless-rust#d6686a6d1d3e6316afaf51c85002cf1cc9167292"
  }
}