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

Copy Resources from External Dependencies into Archived Zip #367

Closed
jrosen081 opened this issue Sep 22, 2024 · 5 comments · Fixed by #386
Closed

Copy Resources from External Dependencies into Archived Zip #367

jrosen081 opened this issue Sep 22, 2024 · 5 comments · Fixed by #386
Labels
bug Something isn't working

Comments

@jrosen081
Copy link
Contributor

Expected behavior

When adding a third-party dependency, I would expect the zip file to correctly have the resources of all dependencies.

Actual behavior

When adding a 3rd party dependency (https://github.com/awslabs/aws-sdk-swift was what happened with me), the resources files for the dependencies were not added to the final zip. This caused an issue when trying to start up the lambda.

Steps to reproduce

  1. Follow this guide (https://fabianfett.dev/getting-started-with-swift-aws-lambda-runtime)
  2. Add AWS SDK to project
  3. Archive and upload to lambda
  4. See failure on launch with fatalerror looking for resource bundle.

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?

1.0.0-alpha-3

Swift version

Swift 5.10

Amazon Linux 2 docker image version

No response

@jrosen081
Copy link
Contributor Author

I was able to work around this by adding my own script which adds the needed resources to the zip file, but it would be great if it worked automatically.

@fabianfett
Copy link
Member

fabianfett commented Sep 26, 2024

We should fix this in the Packager plugin. Do we need to go through all the dependencies and check if they have resources? I assume so.

@fabianfett fabianfett added the bug Something isn't working label Sep 26, 2024
@kkla320
Copy link

kkla320 commented Sep 30, 2024

I was able to work around this by adding my own script which adds the needed resources to the zip file, but it would be great if it worked automatically.

I am currently experiencing the same problem. Until there is a solution integrated into plugin. Could you share your solution here?

@jrosen081
Copy link
Contributor Author

We should fix this in the Packager plugin. Do we need to go through all the dependencies and check if they have resources? I assume so.

Yeah I think so. The resources get put automatically in .build/release/{PACKAGE_NAME}.resources, it likely needs to be copied into the final directory before zipping.

I have added these lines to my local script to make it work:
sudo cp -r .build/release/aws-sdk-swift_AWSClientRuntime.resources .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/{PRODUCT_NAME}/

@jrosen081
Copy link
Contributor Author

@fabianfett I put up a pr here that I believe should fix it (testing locally works) #386. Let me know what you think and what the next steps of the process are for pull requests!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants