swift-aws-lambda-runtime: Lambda could not load resource bundle

I have a swift target including static resources referenced in the package target. This target is included in the Lambda executable. The static resources are available when running locally via a CLI executable. When deployed to Lambda via the archive plugin using 1.0.0-alpha.3 these resources don’t seem to be available. The error from CloudWatch is:

App/resource_bundle_accessor.swift:12: Fatal error: could not load resource bundle: from /var/task/Sandbox_App.resources or /workspace/.build/x86_64-unknown-linux-gnu/release/Sandbox_App.resources

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

Yes, this is just a workaround. I’ll try to fix the root cause.

That’s right. I have just added a step to add the static resource *.resources/hello.txt to the zip before deployment and works as expected.

@johnmorrell if the Lambda packager plugin continues to fail including resources in the zip, please let us know. Include the directory layout, the output of of zip -r <your zip file>, relevant portions of the Package.swift file, and any relevant error messages or steps to reproduce.

@johnmorrell I’ve updated the lambda-runtime-v2 branch so it compiles again and updated the README with a simple example