Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SPM Resources #312

Open
johnbona opened this issue Dec 7, 2023 · 1 comment
Open

Add support for SPM Resources #312

johnbona opened this issue Dec 7, 2023 · 1 comment
Labels
enhancement New feature or request packager The SwiftPM archive plugin

Comments

@johnbona
Copy link

johnbona commented Dec 7, 2023

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

  1. Create a "Hello World" lambda declaring PhoneNumberKit as a dependency
  2. Add let phoneNumberKit = PhoneNumberKit()
  3. 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

@sebsto sebsto added packager The SwiftPM archive plugin enhancement New feature or request labels May 29, 2024
@sebsto
Copy link
Contributor

sebsto commented Jun 22, 2024

@johnbona Can you review #333 and let us know if this implementation would match your needs.
I'm curious to learn about the requirement for the directory name. Can you customize it on PhoneNumberKit side ? Or is it expected to be a specific name ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request packager The SwiftPM archive plugin
Projects
None yet
Development

No branches or pull requests

2 participants