Compile FFI from source using AWS Lambda image#153
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intoMay 19, 2026
Merged
Conversation
Switch layer build from ruby:X.Y (Debian) to public.ecr.aws/lambda/ruby:X.Y so native extensions compile against Lambda's actual glibc/libffi. After datadog gem install, uninstall precompiled FFI (missing Ruby 3.2 ABI) and reinstall from source. Fixes cold-start LoadError on ffi_c with DD_APPSEC_ENABLED=true on Ruby 3.2. Also adds MAKEFLAGS parallelization and --no-document to gem installs.
zarirhamza
approved these changes
May 19, 2026
Contributor
zarirhamza
left a comment
There was a problem hiding this comment.
LGTM - thanks for picking this up
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Switch layer build from
ruby:X.Y(Debian) topublic.ecr.aws/lambda/ruby:X.Yso native extensions compile against Lambda's actualglibc/libffi.After
datadoggem install, uninstall precompiled FFI (missing Ruby 3.2 ABI) and reinstall from source. Fixes cold-start LoadError onffi_cwithDD_APPSEC_ENABLED=trueon Ruby 3.2.Also adds
MAKEFLAGSparallelization and--no-documentto gem installs.Motivation
This should help with datadog gem upgrade in the future.
Testing Guidelines
Locally + CI
Additional Notes
Build time improvement
gem install datadog-lambdagem install datadoggem install ffiThis PR is a compilation of #144 and #152
Types of changes
Check all that apply