Repository: cargo-lambda/cargo-lambda (language: python)

Issue:
"there are more than one binary in the project, you must specify a binary name" error on deploy since v1.0.1
My GitHub Actions builds have recently started failing. They work when pinning cargo-lambda to v1.0.0. I don't believe there should be more than one binary? I can't see any obvious cause in the change log.

For reference, the GH Action (irrelevant in-between steps removed):
```yml

- name: Install Cargo Lambda
  uses: jaxxstorm/action-install-gh-release@v1.9.0
  with:
    repo: cargo-lambda/cargo-lambda
    platform: linux
    arch: x86_64

- name: Build Lambda Binary
  run: cargo lambda build --release --target x86_64-unknown-linux-gnu.2.26
  env:
    RELEASE_NAME: ${{ inputs.release-name }}

- name: Deploy Lambda Binary
  id: deploy
  run: cargo lambda deploy --env-file .env | tee >(echo "VERSION=$(grep -oP 'arn:aws:lambda:.*:.*:function:.*:\K\d+')" >> $GITHUB_OUTPUT)
```

Deploy output with v1.0.0:
```
Run cargo lambda deploy --env-file .env | tee >(echo "VERSION=$(grep -oP 'arn:aws:lambda:.*:.*:function:.*:\K\d+')" >> $GITHUB_OUTPUT)
▹▹▹▹▹ loading binary data
▹▹▹▹▹ deploying function
🔍 function arn: arn:aws:lambda:***:***:function:***:***
```

Deploy output with v1.0.1:
```
Run cargo lambda deploy --env-file .env | tee >(echo "VERSION=$(grep -oP 'arn:aws:lambda:.*:.*:function:.*:\K\d+')" >> $GITHUB_OUTPUT)
▹▹▹▹▹ loading binary data
Error:   × there are more than one binary in the project, you must specify a binary
  │ name

  Was this error unexpected?
  Open an issue in https://github.com/cargo-lambda/cargo-lambda/issues
```



Discussion / hints:
Have you tried this new version locally? what are the contents of the `target/lambda` directory?
You can add the `--binary-name` flag with the name of the binary that you want to deploy. This is probably caused because there are extra binaries in that `target/lambda` directory.
For what it's worth, I've seen the same thing happen in my own actions. It's a little annoying to inspect the action as it's running, but I don't encounter the same error when deploying on my local machine.
In 1.0.1 we fixed a bug that prevented to find some binaries once compiled.

> It's a little annoying to inspect the action as it's running

Have you been able to see that's in the target directory? One option would be to add more information about what's there in the error.
I think the changes in this commit are not correct: https://github.com/cargo-lambda/cargo-lambda/commit/4f8aa1f807538b7f6b04a785dcb7588a0b91dba0#diff-e401ebe58ce90791b1433ceb126c919319a9c738a8b4ecf7b20f9d54a029193dL188

I'll find a better solution to support examples without changing the previous behavior.

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 163cc12d..a48aab11 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -689,12 +689,6 @@ version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce"
 
-[[package]]
-name = "base16ct"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
-
 [[package]]
 name = "base64"
 version = "0.13.1"
@@ -887,8 +881,6 @@ dependencies = [
  "cargo-lambda-invoke",
  "cargo-lambda-new",
  "cargo-lambda-watch",
- "cargo-test-macro",
- "cargo-test-support",
  "clap",
  "clap-cargo",
  "dunce",
@@ -899,7 +891,9 @@ dependencies = [
  "tokio",
  "tracing",
  "tracing-subscriber",
+ "url",
  "uuid",
+ "walkdir",
  "zip",
 ]
 
@@ -1090,59 +1084,6 @@ dependencies = [
  "serde",
 ]
 
-[[package]]
-name = "cargo-test-macro"
-version = "0.1.0"
-source = "git+https://github.com/rust-lang/cargo#6354bb3d813335731838fd7dce2010d040cc2545"
-
-[[package]]
-name = "cargo-test-support"
-version = "0.1.0"
-source = "git+https://github.com/rust-lang/cargo#6354bb3d813335731838fd7dce2010d040cc2545"
-dependencies = [
- "anstream",
- "anstyle",
- "anyhow",
- "cargo-test-macro",
- "cargo-util",
- "crates-io",
- "filetime",
- "flate2",
- "git2",
- "glob",
- "itertools 0.11.0",
- "pasetors",
- "serde",
- "serde_json",
- "snapbox",
- "tar",
- "time",
- "toml 0.8.8",
- "url",
- "windows-sys 0.48.0",
-]
-
-[[package]]
-name = "cargo-util"
-version = "0.2.8"
-source = "git+https://github.com/rust-lang/cargo#6354bb3d813335731838fd7dce2010d040cc2545"
-dependencies = [
- "anyhow",
- "core-foundation",
- "filetime",
- "hex",
- "jobserver",
- "libc",
- "miow",
- "same-file",
- "sha2",
- "shell-escape",
- "tempfile",
- "tracing",
- "walkdir",
- "windows-sys 0.48.0",
-]
-
 [[package]]
 name = "cargo-zigbuild"
 version = "0.17.5"
@@ -1376,19 +1317,6 @@ dependencies = [
  "libc",
 ]
 
-[[package]]
-name = "crates-io"
-version = "0.39.1"
-source = "git+https://github.com/rust-lang/cargo#6354bb3d813335731838fd7dce2010d040cc2545"
-dependencies = [
- "curl",
- "percent-encoding",
- "serde",
- "serde_json",
- "thiserror",
- "url",
-]
-
 [[package]]
 name = "crc32c"
 version = "0.6.4"
@@ -1493,18 +1421,6 @@ dependencies = [
  "zeroize",
 ]
 
-[[package]]
-name = "crypto-bigint"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124"
-dependencies = [
- "generic-array",
- "rand_core",
- "subtle",
- "zeroize",
-]
-
 [[package]]
 name = "crypto-common"
 version = "0.1.6"
@@ -1515,42 +1431,6 @@ dependencies = [
  "typenum",
 ]
 
-[[package]]
-name = "ct-codecs"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df"
-
-[[package]]
-name = "curl"
-version = "0.4.44"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22"
-dependencies = [
- "curl-sys",
- "libc",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "socket2 0.4.10",
- "winapi",
-]
-
-[[package]]
-name = "curl-sys"
-version = "0.4.68+curl-8.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4a0d18d88360e374b16b2273c832b5e57258ffc1d4aa4f96b108e0738d5752f"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
- "windows-sys 0.48.0",
-]
-
 [[package]]
 name = "der"
 version = "0.6.1"
@@ -1561,17 +1441,6 @@ dependencies = [
  "zeroize",
 ]
 
-[[package]]
-name = "der"
-version = "0.7.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c"
-dependencies = [
- "const-oid",
- "pem-rfc7468",
- "zeroize",
-]
-
 [[package]]
 name = "deranged"
 version = "0.3.9"
@@ -1579,7 +1448,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
 dependencies = [
  "powerfmt",
- "serde",
 ]
 
 [[package]]
@@ -1595,7 +1463,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
 dependencies = [
  "block-buffer",
- "const-oid",
  "crypto-common",
  "subtle",
 ]
@@ -1686,33 +1553,10 @@ version = "0.14.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c"
 dependencies = [
- "der 0.6.1",
- "elliptic-curve 0.12.3",
- "rfc6979 0.3.1",
- "signature 1.6.4",
-]
-
-[[package]]
-name = "ecdsa"
-version = "0.16.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4"
-dependencies = [
- "der 0.7.8",
- "digest",
- "elliptic-curve 0.13.6",
- "rfc6979 0.4.0",
- "signature 2.1.0",
- "spki 0.7.2",
-]
-
-[[package]]
-name = "ed25519-compact"
-version = "2.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a3d382e8464107391c8706b4c14b087808ecb909f6c15c34114bc42e53a9e4c"
-dependencies = [
- "getrandom",
+ "der",
+ "elliptic-curve",
+ "rfc6979",
+ "signature",
 ]
 
 [[package]]
@@ -1727,37 +1571,16 @@ version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3"
 dependencies = [
- "base16ct 0.1.1",
- "crypto-bigint 0.4.9",
- "der 0.6.1",
- "digest",
- "ff 0.12.1",
- "generic-array",
- "group 0.12.1",
- "pkcs8 0.9.0",
- "rand_core",
- "sec1 0.3.0",
- "subtle",
- "zeroize",
-]
-
-[[package]]
-name = "elliptic-curve"
-version = "0.13.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914"
-dependencies = [
- "base16ct 0.2.0",
- "crypto-bigint 0.5.3",
+ "base16ct",
+ "crypto-bigint",
+ "der",
  "digest",
- "ff 0.13.0",
+ "ff",
  "generic-array",
- "group 0.13.0",
- "hkdf",
- "pem-rfc7468",
- "pkcs8 0.10.2",
+ "group",
+ "pkcs8",
  "rand_core",
- "sec1 0.7.3",
+ "sec1",
  "subtle",
  "zeroize",
 ]
@@ -1844,22 +1667,6 @@ dependencies = [
  "subtle",
 ]
 
-[[package]]
-name = "ff"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
-dependencies = [
- "rand_core",
- "subtle",
-]
-
-[[package]]
-name = "fiat-crypto"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7"
-
 [[package]]
 name = "filetime"
 version = "0.2.22"
@@ -1885,7 +1692,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
 dependencies = [
  "crc32fast",
- "libz-sys",
  "miniz_oxide",
 ]
 
@@ -1897,9 +1703,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
 
 [[package]]
 name = "form_urlencoded"
-version = "1.2.0"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
+checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
 dependencies = [
  "percent-encoding",
 ]
@@ -2016,7 +1822,6 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
 dependencies = [
  "typenum",
  "version_check",
- "zeroize",
 ]
 
 [[package]]
@@ -2026,10 +1831,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
 dependencies = [
  "cfg-if",
- "js-sys",
  "libc",
  "wasi",
- "wasm-bindgen",
 ]
 
 [[package]]
@@ -2038,21 +1841,6 @@ version = "0.28.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
 
-[[package]]
-name = "git2"
-version = "0.18.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd"
-dependencies = [
- "bitflags 2.4.1",
- "libc",
- "libgit2-sys",
- "log",
- "openssl-probe",
- "openssl-sys",
- "url",
-]
-
 [[package]]
 name = "gix-actor"
 version = "0.19.0"
@@ -2278,12 +2066,6 @@ dependencies = [
  "thiserror",
 ]
 
-[[package]]
-name = "glob"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
-
 [[package]]
 name = "globset"
 version = "0.4.13"
@@ -2314,18 +2096,7 @@ version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
 dependencies = [
- "ff 0.12.1",
- "rand_core",
- "subtle",
-]
-
-[[package]]
-name = "group"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
-dependencies = [
- "ff 0.13.0",
+ "ff",
  "rand_core",
  "subtle",
 ]
@@ -2379,15 +2150,6 @@ version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
 
-[[package]]
-name = "hkdf"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437"
-dependencies = [
- "hmac",
-]
-
 [[package]]
 name = "hmac"
 version = "0.12.1"
@@ -2533,9 +2295,9 @@ dependencies = [
 
 [[package]]
 name = "idna"
-version = "0.4.0"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
+checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
 dependencies = [
  "unicode-bidi",
  "unicode-normalization",
@@ -2693,15 +2455,6 @@ dependencies = [
  "either",
 ]
 
-[[package]]
-name = "itertools"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
-dependencies = [
- "either",
-]
-
 [[package]]
 name = "itoa"
 version = "1.0.9"
@@ -2767,7 +2520,7 @@ dependencies = [
  "diff",
  "ena",
  "is-terminal",
- "itertools 0.10.5",
+ "itertools",
  "lalrpop-util",
  "petgraph",
  "regex",
@@ -2799,46 +2552,6 @@ version = "0.2.149"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
 
-[[package]]
-name = "libgit2-sys"
-version = "0.16.1+1.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c"
-dependencies = [
- "cc",
- "libc",
- "libssh2-sys",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
-]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
-name = "libz-sys"
-version = "1.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
 [[package]]
 name = "linux-raw-sys"
 version = "0.4.10"
@@ -2865,7 +2578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "79e0724dfcaad5cfb7965ea0f178ca0870b8d7315178f4a7179f5696f7f04d5f"
 dependencies = [
  "anymap2",
- "itertools 0.10.5",
+ "itertools",
  "kstring",
  "liquid-derive",
  "num-traits",
@@ -2893,7 +2606,7 @@ version = "0.26.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e2a17e273a6fb1fb6268f7a5867ddfd0bd4683c7e19b51084f3d567fad4348c0"
 dependencies = [
- "itertools 0.10.5",
+ "itertools",
  "liquid-core",
  "once_cell",
  "percent-encoding",
@@ -3087,15 +2800,6 @@ dependencies = [
  "windows-sys 0.48.0",
 ]
 
-[[package]]
-name = "miow"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "359f76430b20a79f9e20e115b3428614e654f04fab314482fc0fda0ebd3c6044"
-dependencies = [
- "windows-sys 0.48.0",
-]
-
 [[package]]
 name = "new_debug_unreachable"
 version = "1.0.4"
@@ -3260,18 +2964,6 @@ version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
 
-[[package]]
-name = "openssl-sys"
-version = "0.9.94"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
 [[package]]
 name = "opentelemetry"
 version = "0.17.0"
@@ -3307,17 +2999,6 @@ version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
 
-[[package]]
-name = "orion"
-version = "0.17.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7abdb10181903c8c4b016ba45d6d6d5af1a1e2a461aa4763a83b87f5df4695e5"
-dependencies = [
- "fiat-crypto",
- "subtle",
- "zeroize",
-]
-
 [[package]]
 name = "os_pipe"
 version = "1.1.4"
@@ -3352,20 +3033,8 @@ version = "0.11.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594"
 dependencies = [
- "ecdsa 0.14.8",
- "elliptic-curve 0.12.3",
- "sha2",
-]
-
-[[package]]
-name = "p384"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209"
-dependencies = [
- "ecdsa 0.16.8",
- "elliptic-curve 0.13.6",
- "primeorder",
+ "ecdsa",
+ "elliptic-curve",
  "sha2",
 ]
 
@@ -3392,27 +3061,6 @@ dependencies = [
  "windows-targets 0.48.5",
 ]
 
-[[package]]
-name = "pasetors"
-version = "0.6.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba765699a309908d55950919a3445e9491453e89b2587b1b2abe4143a48894c0"
-dependencies = [
- "ct-codecs",
- "ed25519-compact",
- "getrandom",
- "orion",
- "p384",
- "rand_core",
- "regex",
- "serde",
- "serde_json",
- "sha2",
- "subtle",
- "time",
- "zeroize",
-]
-
 [[package]]
 name = "password-hash"
 version = "0.4.2"
@@ -3442,20 +3090,11 @@ dependencies = [
  "sha2",
 ]
 
-[[package]]
-name = "pem-rfc7468"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
-dependencies = [
- "base64ct",
-]
-
 [[package]]
 name = "percent-encoding"
-version = "2.3.0"
+version = "2.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
+checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
 
 [[package]]
 name = "pest"
@@ -3597,18 +3236,8 @@ version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba"
 dependencies = [
- "der 0.6.1",
- "spki 0.6.0",
-]
-
-[[package]]
-name = "pkcs8"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
-dependencies = [
- "der 0.7.8",
- "spki 0.7.2",
+ "der",
+ "spki",
 ]
 
 [[package]]
@@ -3647,15 +3276,6 @@ version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
 
-[[package]]
-name = "primeorder"
-version = "0.13.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7dbe9ed3b56368bd99483eb32fe9c17fdd3730aebadc906918ce78d54c7eeb4"
-dependencies = [
- "elliptic-curve 0.13.6",
-]
-
 [[package]]
 name = "proc-macro2"
 version = "1.0.69"
@@ -3865,6 +3485,7 @@ dependencies = [
  "percent-encoding",
  "pin-project-lite",
  "rustls",
+ "rustls-native-certs",
  "rustls-pemfile",
  "serde",
  "serde_json",
@@ -3877,7 +3498,6 @@ dependencies = [
  "wasm-bindgen",
  "wasm-bindgen-futures",
  "web-sys",
- "webpki-roots",
  "winreg",
 ]
 
@@ -3887,21 +3507,11 @@ version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb"
 dependencies = [
- "crypto-bigint 0.4.9",
+ "crypto-bigint",
  "hmac",
  "zeroize",
 ]
 
-[[package]]
-name = "rfc6979"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
-dependencies = [
- "hmac",
- "subtle",
-]
-
 [[package]]
 name = "ring"
 version = "0.17.5"
@@ -4112,24 +3722,10 @@ version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928"
 dependencies = [
- "base16ct 0.1.1",
- "der 0.6.1",
+ "base16ct",
+ "der",
  "generic-array",
- "pkcs8 0.9.0",
- "subtle",
- "zeroize",
-]
-
-[[package]]
-name = "sec1"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
-dependencies = [
- "base16ct 0.2.0",
- "der 0.7.8",
- "generic-array",
- "pkcs8 0.10.2",
+ "pkcs8",
  "subtle",
  "zeroize",
 ]
@@ -4255,12 +3851,6 @@ dependencies = [
  "lazy_static",
 ]
 
-[[package]]
-name = "shell-escape"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
-
 [[package]]
 name = "shlex"
 version = "1.2.0"
@@ -4307,16 +3897,6 @@ dependencies = [
  "rand_core",
 ]
 
-[[package]]
-name = "signature"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500"
-dependencies = [
- "digest",
- "rand_core",
-]
-
 [[package]]
 name = "similar"
 version = "2.3.0"
@@ -4415,17 +3995,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b"
 dependencies = [
  "base64ct",
- "der 0.6.1",
-]
-
-[[package]]
-name = "spki"
-version = "0.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a"
-dependencies = [
- "base64ct",
- "der 0.7.8",
+ "der",
 ]
 
 [[package]]
@@ -4555,16 +4125,6 @@ dependencies = [
  "libc",
 ]
 
-[[package]]
-name = "tar"
-version = "0.4.40"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb"
-dependencies = [
- "filetime",
- "libc",
-]
-
 [[package]]
 name = "target-lexicon"
 version = "0.12.12"
@@ -5077,9 +4637,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
 
 [[package]]
 name = "url"
-version = "2.4.1"
+version = "2.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
+checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
 dependencies = [
  "form_urlencoded",
  "idna",
@@ -5113,12 +4673,6 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
 
-[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
 [[package]]
 name = "version_check"
 version = "0.9.4"
@@ -5302,12 +4856,6 @@ dependencies = [
  "wasm-bindgen",
 ]
 
-[[package]]
-name = "webpki-roots"
-version = "0.25.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
-
 [[package]]
 name = "which"
 version = "4.4.2"
diff --git a/Cargo.toml b/Cargo.toml
index 40f2c786..45a8a6b4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ exclude = [
     "tests/fixtures/target-dir-set-in-project",
     "tests/fixtures/workspace-package",
     "tests/fixtures/single-binary-different-name",
+    "tests/fixtures/examples-package"
 ]
 
 resolver = "2"
diff --git a/crates/cargo-lambda-build/src/lib.rs b/crates/cargo-lambda-build/src/lib.rs
index 1f139e18..03737417 100644
--- a/crates/cargo-lambda-build/src/lib.rs
+++ b/crates/cargo-lambda-build/src/lib.rs
@@ -146,7 +146,8 @@ impl Build {
 
         self.build.target = vec![target_arch.to_string()];
 
-        let binaries = binary_targets_from_metadata(&metadata);
+        let build_examples = self.build.examples || !self.build.example.is_empty();
+        let binaries = binary_targets_from_metadata(&metadata, build_examples);
         debug!(binaries = ?binaries, "found new target binaries to build");
 
         if !self.build.bin.is_empty() {
@@ -222,59 +223,58 @@ impl Build {
             target_dir.join("lambda")
         };
 
-        let base = target_dir
+        let mut base = target_dir
             .join(target_arch.rustc_target_without_glibc_version())
             .join(profile);
+        if build_examples {
+            base = base.join("examples");
+        }
 
         let mut found_binaries = false;
         for name in &binaries {
-            for base in [&base, &base.join("examples")] {
-                let binary = base.join(name);
-                debug!(binary = ?binary, exists = binary.exists(), "checking function binary");
-
-                if binary.exists() {
-                    found_binaries = true;
-
-                    let bootstrap_dir = if self.extension {
-                        lambda_dir.join("extensions")
-                    } else {
-                        match self.flatten {
-                            Some(ref n) if n == name => lambda_dir.clone(),
-                            _ => lambda_dir.join(name),
-                        }
-                    };
-                    create_dir_all(&bootstrap_dir)
-                        .into_diagnostic()
-                        .wrap_err_with(|| {
-                            format!("error creating lambda directory {bootstrap_dir:?}")
-                        })?;
-
-                    let bin_name = if self.extension {
-                        name.as_str()
-                    } else {
-                        "bootstrap"
-                    };
-
-                    match self.output_format {
-                        OutputFormat::Binary => {
-                            let output_location = bootstrap_dir.join(bin_name);
-                            copy_and_replace(&binary, &output_location)
+            let binary = base.join(name);
+            debug!(binary = ?binary, exists = binary.exists(), "checking function binary");
+
+            if binary.exists() {
+                found_binaries = true;
+
+                let bootstrap_dir = if self.extension {
+                    lambda_dir.join("extensions")
+                } else {
+                    match self.flatten {
+                        Some(ref n) if n == name => lambda_dir.clone(),
+                        _ => lambda_dir.join(name),
+                    }
+                };
+                create_dir_all(&bootstrap_dir)
+                    .into_diagnostic()
+                    .wrap_err_with(|| {
+                        format!("error creating lambda directory {bootstrap_dir:?}")
+                    })?;
+
+                let bin_name = if self.extension {
+                    name.as_str()
+                } else {
+                    "bootstrap"
+                };
+
+                match self.output_format {
+                    OutputFormat::Binary => {
+                        let output_location = bootstrap_dir.join(bin_name);
+                        copy_and_replace(&binary, &output_location)
                             .into_diagnostic()
                             .wrap_err_with(|| {
                                 format!("error moving the binary `{binary:?}` into the output location `{output_location:?}`")
                             })?;
-                        }
-                        OutputFormat::Zip => {
-                            let parent = if self.extension && !self.internal {
-                                Some("extensions")
-                            } else {
-                                None
-                            };
-                            zip_binary(bin_name, binary, bootstrap_dir, parent, None)?;
-                        }
                     }
-
-                    break;
+                    OutputFormat::Zip => {
+                        let parent = if self.extension && !self.internal {
+                            Some("extensions")
+                        } else {
+                            None
+                        };
+                        zip_binary(bin_name, binary, bootstrap_dir, parent, None)?;
+                    }
                 }
             }
         }
diff --git a/crates/cargo-lambda-cli/Cargo.toml b/crates/cargo-lambda-cli/Cargo.toml
index e36604ad..27063c8c 100644
--- a/crates/cargo-lambda-cli/Cargo.toml
+++ b/crates/cargo-lambda-cli/Cargo.toml
@@ -35,9 +35,9 @@ tracing-subscriber.workspace = true
 build-data = "0.1"
 
 [dev-dependencies]
-cargo-test-macro = { git = "https://github.com/rust-lang/cargo" }
-cargo-test-support = { git = "https://github.com/rust-lang/cargo" }
 dunce = "1.0.3"
-snapbox = { version = "0.4.3", features = ["cmd", "debug"] }
+snapbox = { version = "0.4.3", features = ["cmd", "debug", "path"] }
+url = "2.5.0"
 uuid.workspace = true
+walkdir = "2.4.0"
 zip.workspace = true
diff --git a/crates/cargo-lambda-metadata/src/cargo.rs b/crates/cargo-lambda-metadata/src/cargo.rs
index 130ddb24..f2bf021d 100644
--- a/crates/cargo-lambda-metadata/src/cargo.rs
+++ b/crates/cargo-lambda-metadata/src/cargo.rs
@@ -1,5 +1,6 @@
 use aws_sdk_lambda::types::Environment;
 pub use cargo_metadata::Metadata as CargoMetadata;
+use cargo_metadata::Target;
 use miette::Result;
 use serde::Deserialize;
 use std::{
@@ -184,20 +185,32 @@ impl DeployConfig {
 /// Extract all the binary target names from a Cargo.toml file
 pub fn binary_targets<P: AsRef<Path> + Debug>(
     manifest_path: P,
+    build_examples: bool,
 ) -> Result<HashSet<String>, MetadataError> {
     let metadata = load_metadata(manifest_path)?;
-    Ok(binary_targets_from_metadata(&metadata))
+    Ok(binary_targets_from_metadata(&metadata, build_examples))
 }
 
-pub fn binary_targets_from_metadata(metadata: &CargoMetadata) -> HashSet<String> {
+pub fn binary_targets_from_metadata(
+    metadata: &CargoMetadata,
+    build_examples: bool,
+) -> HashSet<String> {
+    let condition = |target: &&Target| {
+        if build_examples {
+            // Several targets can have `crate_type` be `bin`, we're only
+            // interested in the ones which `kind` is `bin` or `example`.
+            // See https://doc.rust-lang.org/cargo/commands/cargo-metadata.html?highlight=targets%20metadata#json-format
+            return target.kind.iter().any(|k| k == "bin" || k == "example")
+                && target.crate_types.iter().any(|t| t == "bin");
+        } else {
+            return target.kind.iter().any(|k| k == "bin");
+        }
+    };
+
     metadata
         .packages
         .iter()
-        .flat_map(|p| {
-            p.targets
-                .iter()
-                .filter(|target| target.crate_types.contains(&"bin".to_owned()))
-        })
+        .flat_map(|p| p.targets.iter().filter(condition))
         .map(|target| target.name.clone())
         .collect::<_>()
 }
@@ -434,17 +447,19 @@ pub fn function_build_metadata(metadata: &CargoMetadata) -> Result<BuildConfig,
 /// Use this function when the user didn't provide any funcion name
 /// assuming that there is only one binary in the project
 pub fn main_binary<P: AsRef<Path> + Debug>(manifest_path: P) -> Result<String, MetadataError> {
-    let targets = binary_targets(manifest_path)?;
+    let targets = binary_targets(manifest_path, true)?;
     if targets.len() > 1 {
-        Err(MetadataError::MultipleBinariesInProject)?;
+        let mut vec = targets.into_iter().collect::<Vec<_>>();
+        vec.sort();
+        Err(MetadataError::MultipleBinariesInProject(vec.join(", ")))
     } else if targets.is_empty() {
-        Err(MetadataError::MissingBinaryInProject)?;
+        Err(MetadataError::MissingBinaryInProject)
+    } else {
+        targets
+            .into_iter()
+            .next()
+            .ok_or_else(|| MetadataError::MissingBinaryInProject)
     }
-
-    targets
-        .into_iter()
-        .next()
-        .ok_or_else(|| MetadataError::MissingBinaryInProject)
 }
 
 fn merge_deploy_config(base: &DeployConfig, package_deploy: &DeployConfig) -> DeployConfig {
@@ -507,14 +522,14 @@ mod tests {
 
     #[test]
     fn test_binary_packages() {
-        let bins = binary_targets(fixture("single-binary-package")).unwrap();
+        let bins = binary_targets(fixture("single-binary-package"), false).unwrap();
         assert_eq!(1, bins.len());
         assert!(bins.contains("basic-lambda"));
     }
 
     #[test]
     fn test_binary_packages_with_mutiple_bin_entries() {
-        let bins = binary_targets(fixture("multi-binary-package")).unwrap();
+        let bins = binary_targets(fixture("multi-binary-package"), false).unwrap();
         assert_eq!(5, bins.len());
         assert!(bins.contains("delete-product"));
         assert!(bins.contains("get-product"));
@@ -525,7 +540,7 @@ mod tests {
 
     #[test]
     fn test_binary_packages_with_workspace() {
-        let bins = binary_targets(fixture("workspace-package")).unwrap();
+        let bins = binary_targets(fixture("workspace-package"), false).unwrap();
         assert_eq!(2, bins.len());
         assert!(bins.contains("basic-lambda-1"));
         assert!(bins.contains("basic-lambda-2"));
@@ -533,14 +548,14 @@ mod tests {
 
     #[test]
     fn test_binary_packages_with_mixed_workspace() {
-        let bins = binary_targets(fixture("mixed-workspace-package")).unwrap();
+        let bins = binary_targets(fixture("mixed-workspace-package"), false).unwrap();
         assert_eq!(1, bins.len());
         assert!(bins.contains("function-crate"), "{:?}", bins);
     }
 
     #[test]
     fn test_binary_packages_with_missing_binary_info() {
-        let err = binary_targets(fixture("missing-binary-package")).unwrap_err();
+        let err = binary_targets(fixture("missing-binary-package"), false).unwrap_err();
         assert!(err
             .to_string()
             .contains("a [lib] section, or [[bin]] section must be present"));
@@ -729,7 +744,7 @@ mod tests {
         let manifest_path = fixture("multi-binary-package");
         let err = main_binary(manifest_path).unwrap_err();
         assert_eq!(
-            "there are more than one binary in the project, you must specify a binary name",
+            "there are more than one binary in the project, please specify a binary name with --binary-name or --binary-path. This is the list of binaries I found: delete-product, dynamodb-streams, get-product, get-products, put-product",
             err.to_string()
         );
     }
@@ -759,4 +774,12 @@ mod tests {
             "{s3_tags}"
         );
     }
+
+    #[test]
+    fn test_example_packages() {
+        let bins = binary_targets(fixture("examples-package"), true).unwrap();
+        assert_eq!(2, bins.len());
+        assert!(bins.contains("example-lambda"));
+        assert!(bins.contains("basic-lambda"));
+    }
 }
diff --git a/crates/cargo-lambda-metadata/src/error.rs b/crates/cargo-lambda-metadata/src/error.rs
index c219bd36..60317f7e 100644
--- a/crates/cargo-lambda-metadata/src/error.rs
+++ b/crates/cargo-lambda-metadata/src/error.rs
@@ -17,9 +17,9 @@ pub enum MetadataError {
     #[error("invalid tracing option `{0}`")]
     #[diagnostic()]
     InvalidTracing(String),
-    #[error("there are more than one binary in the project, you must specify a binary name")]
+    #[error("there are more than one binary in the project, please specify a binary name with --binary-name or --binary-path. This is the list of binaries I found: {0}")]
     #[diagnostic()]
-    MultipleBinariesInProject,
+    MultipleBinariesInProject(String),
     #[error("there are no binaries in this project")]
     #[diagnostic()]
     MissingBinaryInProject,
diff --git a/crates/cargo-lambda-watch/src/lib.rs b/crates/cargo-lambda-watch/src/lib.rs
index 29cc0049..4d765323 100644
--- a/crates/cargo-lambda-watch/src/lib.rs
+++ b/crates/cargo-lambda-watch/src/lib.rs
@@ -131,7 +131,7 @@ impl Watch {
 
         let env = self.env_options.lambda_environment().into_diagnostic()?;
 
-        let binary_packages = binary_targets(&cargo_options.manifest_path)
+        let binary_packages = binary_targets(&cargo_options.manifest_path, false)
             .map_err(ServerError::FailedToReadMetadata)?;
         let start_function = match binary_packages.len() {
             0 => Err(ServerError::NoBinaryPackages)?,


Test patch:
diff --git a/crates/cargo-lambda-cli/integration-tests/cargo_lambda.rs b/crates/cargo-lambda-cli/tests/cargo_lambda.rs
similarity index 75%
rename from crates/cargo-lambda-cli/integration-tests/cargo_lambda.rs
rename to crates/cargo-lambda-cli/tests/cargo_lambda.rs
index 32168b54..1cec0304 100644
--- a/crates/cargo-lambda-cli/integration-tests/cargo_lambda.rs
+++ b/crates/cargo-lambda-cli/tests/cargo_lambda.rs
@@ -1,4 +1,3 @@
-use cargo_test_macro::cargo_test;
 use std::{
     fs::{create_dir_all, read_to_string, File},
     io::Write,
@@ -6,10 +5,14 @@ use std::{
 use zip::ZipArchive;
 
 mod harness;
-use harness::{cargo_lambda_build, cargo_lambda_init, cargo_lambda_new, LambdaProjectExt};
+use harness::{
+    cargo_lambda_build, cargo_lambda_init, cargo_lambda_new, init_root, CargoPathExt,
+    LambdaProjectExt,
+};
 
-#[cargo_test]
+#[test]
 fn test_build_basic_function() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-basic-function");
 
     lp.new_cmd()
@@ -25,8 +28,9 @@ fn test_build_basic_function() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_basic_zip_function() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-basic-function");
 
     lp.new_cmd()
@@ -52,8 +56,9 @@ fn test_build_basic_zip_function() {
     );
 }
 
-#[cargo_test]
+#[test]
 fn test_build_http_function() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-http-function");
 
     lp.new_cmd().arg("--http").arg(&lp.name).assert().success();
@@ -65,8 +70,9 @@ fn test_build_http_function() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_http_feature_function() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-http-function");
 
     lp.new_cmd()
@@ -83,8 +89,9 @@ fn test_build_http_feature_function() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_event_type_function() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-event-type-function");
 
     lp.new_cmd()
@@ -101,8 +108,9 @@ fn test_build_event_type_function() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_basic_extension() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-basic-extension");
 
     lp.new_cmd()
@@ -121,8 +129,9 @@ fn test_build_basic_extension() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_logs_extension() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-logs-extension");
 
     lp.new_cmd()
@@ -142,8 +151,9 @@ fn test_build_logs_extension() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_telemetry_extension() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-telemetry-extension");
 
     lp.new_cmd()
@@ -163,8 +173,9 @@ fn test_build_telemetry_extension() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_init_subcommand() {
+    let _guard = init_root();
     let lp = cargo_lambda_init("test-basic-function");
     let root = lp.root();
 
@@ -182,8 +193,9 @@ fn test_init_subcommand() {
     assert!(bin.exists(), "{:?} doesn't exist", bin);
 }
 
-#[cargo_test]
+#[test]
 fn test_init_subcommand_without_override() {
+    let _guard = init_root();
     let lp = cargo_lambda_init("test-basic-function");
     let root = lp.root();
 
@@ -212,8 +224,9 @@ fn test_init_subcommand_without_override() {
     assert_eq!(content, out);
 }
 
-#[cargo_test]
+#[test]
 fn test_build_basic_zip_extension() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-basic-extension");
 
     lp.new_cmd()
@@ -241,8 +254,9 @@ fn test_build_basic_zip_extension() {
     );
 }
 
-#[cargo_test]
+#[test]
 fn test_build_internal_zip_extension() {
+    let _guard = init_root();
     let lp = cargo_lambda_new("test-internal-extension");
 
     lp.new_cmd()
@@ -270,3 +284,58 @@ fn test_build_internal_zip_extension() {
         zip.file_names().collect::<Vec<&str>>().join(", ")
     );
 }
+
+#[test]
+fn test_build_example() {
+    let _guard = init_root();
+    let lp = cargo_lambda_new("test-example");
+    lp.new_cmd()
+        .arg("--no-interactive")
+        .arg(&lp.name)
+        .assert()
+        .success();
+
+    let project = lp.test_project();
+    let root = project.root();
+
+    let examples_dir = root.join("examples");
+    let example = examples_dir.join("example-lambda.rs");
+    create_dir_all(examples_dir).expect("failed to create examples directory");
+
+    let mut example_file = File::create(&example).expect("failed to create main.rs file");
+    let content = r#"fn main() {
+        println!("Hello, world!");
+    }"#;
+    example_file
+        .write_all(content.as_bytes())
+        .expect("failed to create example content");
+    example_file.flush().unwrap();
+
+    // Build examples and check that only the example is in the Lambda directory.
+    cargo_lambda_build(project.root())
+        .arg("--examples")
+        .assert()
+        .success();
+
+    let bin = project.lambda_function_bin("example-lambda");
+    assert!(bin.exists(), "{:?} doesn't exist", bin);
+
+    let bin = project.lambda_function_bin(&lp.name);
+    assert!(!bin.exists(), "{:?} exists, but it shoudn't", bin);
+
+    project.lambda_dir().rm_rf();
+
+    // Build project and check that only the main binary is in the Lambda directory.
+    cargo_lambda_build(project.root()).assert().success();
+
+    let bin = project.lambda_function_bin("example-lambda");
+    assert!(!bin.exists(), "{:?} exists, but it shouldn't", bin);
+
+    let bin = project.lambda_function_bin(&lp.name);
+    assert!(
+        bin.exists(),
+        "{:?} doesn't exist in directory: {:?}",
+        &lp.name,
+        project.lambda_dir().ls_r()
+    );
+}
diff --git a/crates/cargo-lambda-cli/integration-tests/harness/mod.rs b/crates/cargo-lambda-cli/tests/harness/mod.rs
similarity index 91%
rename from crates/cargo-lambda-cli/integration-tests/harness/mod.rs
rename to crates/cargo-lambda-cli/tests/harness/mod.rs
index 33dbde92..8c8857cf 100644
--- a/crates/cargo-lambda-cli/integration-tests/harness/mod.rs
+++ b/crates/cargo-lambda-cli/tests/harness/mod.rs
@@ -3,9 +3,12 @@ use std::{
     path::{Path, PathBuf},
 };
 
-use cargo_test_support::Project;
 use snapbox::cmd::Command;
 
+mod project;
+use project::Project;
+pub use project::{paths::init_root, CargoPathExt};
+
 pub struct LambdaProject {
     pub name: String,
     root: PathBuf,
@@ -56,7 +59,7 @@ pub fn test_project<P: AsRef<Path>>(path: P) -> Project {
 }
 
 pub fn cargo_lambda_new(project_name: &str) -> LambdaProject {
-    let project = project();
+    let project = project::project().build();
 
     let cwd = dunce::canonicalize(project.root()).expect("failed to create canonical path");
     let name = format!("{}-{}", project_name, uuid::Uuid::new_v4());
@@ -66,7 +69,7 @@ pub fn cargo_lambda_new(project_name: &str) -> LambdaProject {
 }
 
 pub fn cargo_lambda_init(project_name: &str) -> LambdaProject {
-    let project = project();
+    let project = project::project().build();
 
     let cwd = dunce::canonicalize(project.root()).expect("failed to create canonical path");
     fs::create_dir_all(&cwd).expect("failed to create project directory");
@@ -92,10 +95,6 @@ pub fn cargo_lambda_build<P: AsRef<Path>>(path: P) -> Command {
         .current_dir(path)
 }
 
-pub fn project() -> Project {
-    cargo_test_support::project().no_manifest().build()
-}
-
 fn cargo_exe() -> std::path::PathBuf {
     snapbox::cmd::cargo_bin("cargo-lambda")
 }
@@ -106,7 +105,7 @@ pub trait LambdaCommandExt {
 
 impl LambdaCommandExt for Command {
     fn cargo_lambda() -> Self {
-        Self::new(cargo_exe()).with_assert(cargo_test_support::compare::assert_ui())
+        Self::new(cargo_exe()).with_assert(project::assert_ui())
     }
 }
 
diff --git a/crates/cargo-lambda-cli/tests/harness/project.rs b/crates/cargo-lambda-cli/tests/harness/project.rs
new file mode 100644
index 00000000..af233bcb
--- /dev/null
+++ b/crates/cargo-lambda-cli/tests/harness/project.rs
@@ -0,0 +1,287 @@
+// Code extracted from Cargo: https://github.com/rust-lang/cargo/tree/master/crates/cargo-test-support
+// Under MIT License: https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT
+
+use std::{
+    env,
+    fmt::Write,
+    fs,
+    io::ErrorKind,
+    path::{Path, PathBuf},
+};
+
+/// A cargo project to run tests against.
+///
+/// See [`ProjectBuilder`] or [`Project::from_template`] to get started.
+pub struct Project {
+    root: PathBuf,
+}
+
+/// Create a project to run tests against
+///
+/// The project can be constructed programmatically or from the filesystem with [`Project::from_template`]
+#[must_use]
+pub struct ProjectBuilder {
+    root: Project,
+}
+
+impl ProjectBuilder {
+    pub fn new(root: PathBuf) -> ProjectBuilder {
+        ProjectBuilder {
+            root: Project { root },
+        }
+    }
+
+    /// Creates the project.
+    pub fn build(self) -> Project {
+        // First, clean the directory if it already exists
+        self.rm_root();
+
+        // Create the empty directory
+        self.root.root().mkdir_p();
+
+        let ProjectBuilder { root, .. } = self;
+        root
+    }
+
+    fn rm_root(&self) {
+        self.root.root().rm_rf()
+    }
+}
+
+impl Project {
+    /// Copy the test project from a fixed state
+    pub fn from_template(template_path: impl AsRef<std::path::Path>) -> Self {
+        let root = paths::root();
+        let project_root = root.join("case");
+        snapbox::path::copy_template(template_path.as_ref(), &project_root).unwrap();
+        Self { root: project_root }
+    }
+
+    /// Root of the project, ex: `/path/to/cargo/target/cit/t0/foo`
+    pub fn root(&self) -> PathBuf {
+        self.root.clone()
+    }
+
+    /// Project's target dir, ex: `/path/to/cargo/target/cit/t0/foo/target`
+    pub fn build_dir(&self) -> PathBuf {
+        self.root().join("target")
+    }
+
+    // /// Changes the contents of an existing file.
+    pub fn change_file(&self, path: &str, body: &str) {
+        FileBuilder::new(self.root().join(path), body, false).mk()
+    }
+
+    /// Returns the contents of a path in the project root
+    pub fn read_file(&self, path: &str) -> String {
+        let full = self.root().join(path);
+        fs::read_to_string(&full)
+            .unwrap_or_else(|e| panic!("could not read file {}: {}", full.display(), e))
+    }
+}
+
+// Generates a project layout
+pub fn project() -> ProjectBuilder {
+    ProjectBuilder::new(paths::root().join("foo"))
+}
+
+#[derive(PartialEq, Clone)]
+struct FileBuilder {
+    path: PathBuf,
+    body: String,
+    executable: bool,
+}
+
+impl FileBuilder {
+    pub fn new(path: PathBuf, body: &str, executable: bool) -> FileBuilder {
+        FileBuilder {
+            path,
+            body: body.to_string(),
+            executable: executable,
+        }
+    }
+
+    fn mk(&mut self) {
+        if self.executable {
+            let mut path = self.path.clone().into_os_string();
+            write!(path, "{}", env::consts::EXE_SUFFIX).unwrap();
+            self.path = path.into();
+        }
+
+        self.dirname().mkdir_p();
+        fs::write(&self.path, &self.body)
+            .unwrap_or_else(|e| panic!("could not create file {}: {}", self.path.display(), e));
+
+        #[cfg(unix)]
+        if self.executable {
+            use std::os::unix::fs::PermissionsExt;
+
+            let mut perms = fs::metadata(&self.path).unwrap().permissions();
+            let mode = perms.mode();
+            perms.set_mode(mode | 0o111);
+            fs::set_permissions(&self.path, perms).unwrap();
+        }
+    }
+
+    fn dirname(&self) -> &Path {
+        self.path.parent().unwrap()
+    }
+}
+
+pub trait CargoPathExt {
+    fn rm_rf(&self);
+    fn mkdir_p(&self);
+
+    /// Returns a list of all files and directories underneath the given
+    /// directory, recursively, including the starting path.
+    fn ls_r(&self) -> Vec<PathBuf>;
+}
+
+impl CargoPathExt for Path {
+    fn rm_rf(&self) {
+        let meta = match self.symlink_metadata() {
+            Ok(meta) => meta,
+            Err(e) => {
+                if e.kind() == ErrorKind::NotFound {
+                    return;
+                }
+                panic!("failed to remove {:?}, could not read: {:?}", self, e);
+            }
+        };
+        // There is a race condition between fetching the metadata and
+        // actually performing the removal, but we don't care all that much
+        // for our tests.
+        if meta.is_dir() {
+            if let Err(e) = fs::remove_dir_all(self) {
+                panic!("failed to remove {:?}: {:?}", self, e)
+            }
+        } else if let Err(e) = fs::remove_file(self) {
+            panic!("failed to remove {:?}: {:?}", self, e)
+        }
+    }
+
+    fn mkdir_p(&self) {
+        fs::create_dir_all(self)
+            .unwrap_or_else(|e| panic!("failed to mkdir_p {}: {}", self.display(), e))
+    }
+
+    fn ls_r(&self) -> Vec<PathBuf> {
+        walkdir::WalkDir::new(self)
+            .sort_by_file_name()
+            .into_iter()
+            .filter_map(|e| e.map(|e| e.path().to_owned()).ok())
+            .collect()
+    }
+}
+
+pub mod paths {
+    use super::CargoPathExt;
+    use std::{
+        cell::RefCell,
+        path::PathBuf,
+        sync::{
+            atomic::{AtomicUsize, Ordering},
+            Mutex, OnceLock,
+        },
+    };
+
+    static CARGO_INTEGRATION_TEST_DIR: &str = "cit";
+
+    static GLOBAL_ROOT: OnceLock<Mutex<Option<PathBuf>>> = OnceLock::new();
+
+    thread_local! {
+        static TEST_ID: RefCell<Option<usize>> = RefCell::new(None);
+    }
+
+    pub struct TestIdGuard {
+        _private: (),
+    }
+
+    impl Drop for TestIdGuard {
+        fn drop(&mut self) {
+            TEST_ID.with(|n| *n.borrow_mut() = None);
+        }
+    }
+
+    pub fn init_root() -> TestIdGuard {
+        static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
+
+        let id = NEXT_ID.fetch_add(1, Ordering::SeqCst);
+        TEST_ID.with(|n| *n.borrow_mut() = Some(id));
+
+        let guard = TestIdGuard { _private: () };
+
+        set_global_root();
+        let r = root();
+        r.rm_rf();
+        r.mkdir_p();
+
+        guard
+    }
+
+    pub fn root() -> PathBuf {
+        let id = TEST_ID.with(|n| {
+            n.borrow()
+                .expect("Tests must call `init_root` to use the crate root.")
+        });
+
+        let mut root = global_root();
+        root.push(&format!("t{}", id));
+        root
+    }
+
+    fn set_global_root() {
+        let mut lock = GLOBAL_ROOT
+            .get_or_init(|| Default::default())
+            .lock()
+            .unwrap();
+        if lock.is_none() {
+            let mut root = global_root_legacy();
+
+            root.push(CARGO_INTEGRATION_TEST_DIR);
+            *lock = Some(root);
+        }
+    }
+
+    pub fn global_root() -> PathBuf {
+        let lock = GLOBAL_ROOT
+            .get_or_init(|| Default::default())
+            .lock()
+            .unwrap();
+        match lock.as_ref() {
+            Some(p) => p.clone(),
+            None => unreachable!("GLOBAL_ROOT not set yet"),
+        }
+    }
+
+    fn global_root_legacy() -> PathBuf {
+        let mut path = std::env::current_exe().expect("");
+        path.pop(); // chop off exe name
+        path.pop(); // chop off "deps"
+        path.push("tmp");
+        path.mkdir_p();
+        path
+    }
+}
+
+pub(crate) fn assert_ui() -> snapbox::Assert {
+    let root = paths::root();
+    // Use `from_file_path` instead of `from_dir_path` so the trailing slash is
+    // put in the users output, rather than hidden in the variable
+    let root_url = url::Url::from_file_path(&root).unwrap().to_string();
+    let root = root.display().to_string();
+
+    let mut subs = snapbox::Substitutions::new();
+    subs.extend([
+        (
+            "[EXE]",
+            std::borrow::Cow::Borrowed(std::env::consts::EXE_SUFFIX),
+        ),
+        ("[ROOT]", std::borrow::Cow::Owned(root)),
+        ("[ROOTURL]", std::borrow::Cow::Owned(root_url)),
+    ])
+    .unwrap();
+    snapbox::Assert::new()
+        .action_env(snapbox::DEFAULT_ACTION_ENV)
+        .substitutions(subs)
+}
diff --git a/tests/fixtures/examples-package/Cargo.lock b/tests/fixtures/examples-package/Cargo.lock
new file mode 100644
index 00000000..49c0277f
--- /dev/null
+++ b/tests/fixtures/examples-package/Cargo.lock
@@ -0,0 +1,894 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
+name = "async-stream"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
+dependencies = [
+ "async-stream-impl",
+ "futures-core",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "async-stream-impl"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "backtrace"
+version = "0.3.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
+dependencies = [
+ "addr2line",
+ "cc",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
+[[package]]
+name = "basic-lambda"
+version = "0.1.0"
+dependencies = [
+ "lambda_runtime",
+ "serde",
+ "tokio",
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "bytes"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
+
+[[package]]
+name = "cc"
+version = "1.0.83"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
+name = "futures-channel"
+version = "0.3.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
+
+[[package]]
+name = "futures-task"
+version = "0.3.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
+
+[[package]]
+name = "futures-util"
+version = "0.3.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "pin-utils",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
+[[package]]
+name = "gimli"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+
+[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
+[[package]]
+name = "hdrhistogram"
+version = "7.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d"
+dependencies = [
+ "byteorder",
+ "num-traits",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
+
+[[package]]
+name = "http"
+version = "0.2.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
+dependencies = [
+ "bytes",
+ "fnv",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
+dependencies = [
+ "bytes",
+ "http",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
+
+[[package]]
+name = "httpdate"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
+
+[[package]]
+name = "hyper"
+version = "0.14.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "want",
+]
+
+[[package]]
+name = "indexmap"
+version = "1.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
+
+[[package]]
+name = "lambda_runtime"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c73464e59463e91bf179195a308738477df90240173649d5dd2a1f3a2e4a2d2"
+dependencies = [
+ "async-stream",
+ "bytes",
+ "http",
+ "hyper",
+ "lambda_runtime_api_client",
+ "serde",
+ "serde_json",
+ "tokio",
+ "tokio-stream",
+ "tower",
+ "tracing",
+]
+
+[[package]]
+name = "lambda_runtime_api_client"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e921024b5eb4e2f0800a5d6e25c7ed554562aa62f02cf5f60a48c26c8a678974"
+dependencies = [
+ "http",
+ "hyper",
+ "tokio",
+ "tower-service",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.152"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
+
+[[package]]
+name = "lock_api"
+version = "0.4.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+
+[[package]]
+name = "memchr"
+version = "2.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
+dependencies = [
+ "adler",
+]
+
+[[package]]
+name = "mio"
+version = "0.8.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys",
+]
+
+[[package]]
+name = "nu-ansi-term"
+version = "0.46.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+dependencies = [
+ "overload",
+ "winapi",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "object"
+version = "0.32.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+
+[[package]]
+name = "overload"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets",
+]
+
+[[package]]
+name = "pin-project"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.78"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
+
+[[package]]
+name = "ryu"
+version = "1.0.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "serde"
+version = "1.0.195"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.195"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.111"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "slab"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
+
+[[package]]
+name = "socket2"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "thread_local"
+version = "1.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+]
+
+[[package]]
+name = "tokio"
+version = "1.35.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
+dependencies = [
+ "backtrace",
+ "bytes",
+ "libc",
+ "mio",
+ "num_cpus",
+ "parking_lot",
+ "pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tokio-stream"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
+dependencies = [
+ "futures-core",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tower"
+version = "0.4.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "hdrhistogram",
+ "indexmap",
+ "pin-project",
+ "pin-project-lite",
+ "rand",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
+
+[[package]]
+name = "tower-service"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
+
+[[package]]
+name = "tracing"
+version = "0.1.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
+dependencies = [
+ "log",
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
+dependencies = [
+ "once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
+dependencies = [
+ "log",
+ "once_cell",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
+dependencies = [
+ "nu-ansi-term",
+ "sharded-slab",
+ "smallvec",
+ "thread_local",
+ "tracing-core",
+ "tracing-log",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "valuable"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
diff --git a/tests/fixtures/examples-package/Cargo.toml b/tests/fixtures/examples-package/Cargo.toml
new file mode 100644
index 00000000..d0d5a6bb
--- /dev/null
+++ b/tests/fixtures/examples-package/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "basic-lambda"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+lambda_runtime = "0.5.0"
+serde = "1.0.136"
+tokio = { version = "1.17.0", features = ["full"] }
+tracing = "0.1.32"
+tracing-subscriber = "0.3.9"
+
+[[bin]]
+name = "basic-lambda"
+path = "src/main.rs"
+test = false
+
+[package.metadata.lambda.env]
+FOO = "BAR"
\ No newline at end of file
diff --git a/tests/fixtures/examples-package/examples/example-lambda.rs b/tests/fixtures/examples-package/examples/example-lambda.rs
new file mode 100644
index 00000000..f328e4d9
--- /dev/null
+++ b/tests/fixtures/examples-package/examples/example-lambda.rs
@@ -0,0 +1,1 @@
+fn main() {}
diff --git a/tests/fixtures/examples-package/src/main.rs b/tests/fixtures/examples-package/src/main.rs
new file mode 100644
index 00000000..f328e4d9
--- /dev/null
+++ b/tests/fixtures/examples-package/src/main.rs
@@ -0,0 +1,1 @@
+fn main() {}