Swift 5.3 Resources for Lambda (Linux)

I have a package that I'm intending to deploy on an AWS lambda (following this tutorial). The package has 2 targets - the library is one target, and the lambda is another target (the executable). The lambda target basically just has 1 file (main.swift) and imports the library.

When generating the code and running a standard executable (not for a lambda), all of the normal commands pass (build, run, and test). All of my resources are compiled and work correctly.

However, when I build and deploy on the lambda function I created, I get the following error:

Fatal error: could not load resource bundle:
from /var/task/<package>_<target>.resources
or /src/.build/x86_64-unknown-linux-gnu/release/<package>_<target>.resources:
file <target>/resource_bundle_accessor.swift, line 11

I do see that it is similar to this topic, but when running swift test it works just fine.

I can post my Package.swift file, package structure, just not sure what's relevant.

I figured out that it was a problem with the shell script (package.sh). It wasn't copying over the resources into the lambda.zip it was creating

1 Like

Out of curiosity, how are you using these resources? what kind of resources?

Terms of Service

Privacy Policy

Cookie Policy