Closed
Description
Expected behavior
Hello!
We're looking to utilize PhoneNumberKit which packages Google's libphonenumber metadata for phone number validation.
When archiving the project using the built-in AWSLambdaPackager plugin, the project successfully compiles and generates the .zip to upload to AWS. Given that PhoneNumberKit declares the Google libphonenumber metadata as a resource for the target, it's expected that AWSLambdaPackager would include the resource in the generated .zip file.
For reference, the swift-lambda project added support for SPM resources with this commit: SwiftXcode/swift-lambda@dac42bc
Actual behavior
The AWSLambdaPackager plugin does not include SPM resources in the .zip and at runtime, the lambda crashes with the following error:
PhoneNumberKit/resource_bundle_accessor.swift:11: Fatal error: could not load resource bundle: from /var/task/PhoneNumberKit_PhoneNumberKit.resources or /workspace/.build/aarch64-unknown-linux-gnu/release/PhoneNumberKit_PhoneNumberKit.resources
Steps to reproduce
- Create a "Hello World" lambda declaring PhoneNumberKit as a dependency
- Add
let phoneNumberKit = PhoneNumberKit()
- Execute the lambda and will crash when PhoneNumberKit attempts to load the libphonenumber metadata resource
If possible, minimal yet complete reproducer code (or URL to code)
No response
What version of this project (swift-aws-lambda-runtime
) are you using?
main
Swift version
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx14.0
Darwin Computer.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
Amazon Linux 2 docker image version
5.9-amazonlinux2