Skip to content

Commit bc264b3

Browse files
amitksingh1490Forge
andauthored
fix: add musl support for AWS Lambda builds (#3348)
Co-authored-by: Forge <[email protected]>
1 parent c82d023 commit bc264b3

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ jobs:
4747

4848
steps:
4949
- uses: actions/checkout@v4
50+
- name: Install musl-tools
51+
run: |
52+
sudo apt-get update && sudo apt-get install -y musl-tools
5053
5154
- name: Install Rust
5255
uses: actions-rust-lang/setup-rust-toolchain@v1
56+
with:
57+
target: x86_64-unknown-linux-musl
58+
rustflags: -C target-feature=+crt-static -C linker=rust-lld
5359

5460
- name: Install Python
5561
uses: actions/setup-python@v5
@@ -60,8 +66,11 @@ jobs:
6066
run: pip install cargo-lambda
6167

6268
- name: Build
63-
run: cargo lambda build
64-
69+
env:
70+
RUSTFLAGS: -C target-feature=+crt-static -C linker=rust-lld
71+
run: |
72+
# Disable sanitizer features in dependencies
73+
CARGO_FEATURE_SANITIZE=0 CARGO_FEATURE_SANITIZE_MEMORY=0 cargo lambda build --release --target x86_64-unknown-linux-musl
6574
test_wasm:
6675
name: Run Tests (WASM)
6776
runs-on: ubuntu-latest
@@ -343,9 +352,15 @@ jobs:
343352
steps:
344353
- name: Checkout Current Branch (Fast)
345354
uses: actions/checkout@v4
355+
- name: Install musl-tools
356+
run: |
357+
sudo apt-get update && sudo apt-get install -y musl-tools
346358
347359
- name: Install Correct Toolchain
348360
uses: actions-rust-lang/setup-rust-toolchain@v1
361+
with:
362+
target: x86_64-unknown-linux-musl
363+
rustflags: -C target-feature=+crt-static -C linker=rust-lld
349364

350365
- name: Install Python
351366
uses: actions/setup-python@v5
@@ -359,7 +374,10 @@ jobs:
359374
env:
360375
APP_VERSION: ${{ needs.draft_release.outputs.create_release_name }}
361376
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
362-
run: cargo lambda build -p tailcall-aws-lambda --release --target x86_64-unknown-linux-musl
377+
RUSTFLAGS: -C target-feature=+crt-static -C linker=rust-lld
378+
run: |
379+
# Disable sanitizer features in dependencies
380+
CARGO_FEATURE_SANITIZE=0 CARGO_FEATURE_SANITIZE_MEMORY=0 cargo lambda build -p tailcall-aws-lambda --release --target x86_64-unknown-linux-musl
363381
364382
- name: Rename Binary with Target Name
365383
run: |

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ opentelemetry-appender-tracing = { version = "0.4.0" }
141141
opentelemetry-prometheus = "0.16.0"
142142
phonenumber = "0.3.4"
143143
chrono = "0.4.38"
144-
async-graphql-extension-apollo-tracing = { version = "3.2.15" }
144+
async-graphql-extension-apollo-tracing = { version = "3.2.15"}
145145
headers = { workspace = true }
146146
http = { workspace = true }
147147
mime = "0.3.17"

tailcall-aws-lambda/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ edition = "2021"
1515
# and it will keep the alphabetic ordering for you.
1616

1717
[dependencies]
18-
lambda_http = "0.14.0"
19-
lambda_runtime = "0.13.0"
18+
lambda_http = { version = "0.14.0", default-features = true }
19+
lambda_runtime = { version = "0.13.0", default-features = true }
2020
tokio = { version = "1", features = ["macros", "fs"] }
2121
tracing = { version = "0.1.40", features = ["log"] }
2222
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["fmt"] }
2323
dotenvy = "0.15.7"
2424

2525
anyhow = "1.0.82"
2626
async-trait = "0.1.80"
27-
async-graphql-value = "7.0.3"
27+
async-graphql-value = { version = "7.0.3", default-features = false }
2828
hyper = { version = "0.14.28", default-features = false }
2929
http = { workspace = true }
30-
reqwest = { version = "0.11", default-features = false }
31-
tailcall = { path = "..", default-features = false }
30+
reqwest = { version = "0.11", default-features = false, features = ["json","rustls-tls"] }
31+
tailcall = { path = "..", default-features = false}

0 commit comments

Comments
 (0)