Skip to content

[Lambda] Code Source - Editor Bug

0

In our company we have been experimenting with custom runtime environments and languages. We developed a few bootstrap executables using zig and compiled them down to the proper architectures, but when we uploaded the executables using the drag and drop functionality in the code editor, the file gets corrupted.

When downloading the bootstrap executables back again, the file are not the same, the size has changed (even though the filesize in the code editor seems to be normal). We tested with other files in different scenarios and all seems to be related to the implementation of the file writer when dealing with binary data.

It was really hard to track down this issue because at first we thought we could be compiling our source code to the wrong architecture.

Hope this helps to other people that are using this feature and have encountered similar issues. For now, we will use the upload from zip file functionality.

asked 2 years ago279 views

2 Answers
0

Thank you for sharing your experience with custom runtime environments and the issues you encountered when uploading bootstrap executables using the Lambda code editor's drag and drop functionality. This is indeed a valuable insight for others who might be working with custom runtimes or binary files in AWS Lambda.

The issue you've described, where binary files become corrupted when uploaded via the drag and drop feature in the Lambda code editor, is not a commonly reported problem but it's certainly concerning. It's good that you were able to identify the root cause after initially suspecting architecture incompatibility issues.

For those working with custom runtimes, binary files, or any non-text based content, it's advisable to use the "upload from zip file" functionality as you've suggested. This method is generally more reliable for maintaining file integrity, especially for binary or executable files.

When working with custom runtimes or any complex Lambda deployments, it's often best to package your function code and dependencies into a .zip file archive and upload it directly. This approach not only helps avoid potential file corruption issues but also allows for better organization of your code and dependencies.

For others encountering similar issues, here are a few additional recommendations:

  1. Always verify the integrity of your files after uploading, especially for critical components like custom runtime bootstraps.

  2. Consider using AWS CLI or SDKs for deploying functions with custom runtimes or binary files, as these methods can be more robust than the console interface.

  3. If you need to frequently update your code, consider setting up a CI/CD pipeline that packages and deploys your Lambda function, bypassing the console editor entirely.

  4. For larger projects or those with complex dependencies, consider using Lambda Layers to separate your runtime environment from your function code.

It's great that you've shared this information, as it can help other developers avoid similar pitfalls when working with custom runtimes and binary files in AWS Lambda. Your experience highlights the importance of thorough testing and verification when working with advanced Lambda configurations.
Sources
Tutorial: Building a custom runtime - AWS Lambda
Deploying Lambda functions as .zip file archives - AWS Lambda

answered 2 years ago

0

You're spot on — the Lambda code editor isn’t designed for binary files like custom bootstrap executables. When uploading via drag-and-drop, it can corrupt binaries due to improper handling of raw data (e.g., encoding issues), even if the file size appears correct.

✅ Workaround: Always upload binaries using the ZIP upload option or automate with the AWS CLI for accurate deployment.

Thanks for sharing — this will definitely help others working with custom runtimes like Zig!

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.