Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ci): bundle pdfium lib into document-text-extractor lambda zip (#4083)

gbirmanbdb8d51a62f5
diff --git a/.github/scripts/build-cloud-storage-lambdas-nix.sh b/.github/scripts/build-cloud-storage-lambdas-nix.sh
index 42acbdc167..95580589e0 100755
--- a/.github/scripts/build-cloud-storage-lambdas-nix.sh
+++ b/.github/scripts/build-cloud-storage-lambdas-nix.sh
@@ -65,6 +65,13 @@ for lambda in "${LAMBDAS[@]}"; do
if [[ "$lambda" == "call_recording_preview_handler" ]]; then
test -f "$OUTPUT_DIR/target/lambda/$lambda/ffmpeg-layer.zip"
fi
+ # document_text_extractor dlopen's ./pdfium-lib/linux/libpdfium.so at runtime,
+ # so the blob has to be bundled inside bootstrap.zip (see deployLambdaPackage
+ # in flake.nix) -- guard against shipping the binary without it.
+ if [[ "$lambda" == "document_text_extractor" ]]; then
+ unzip -l "$OUTPUT_DIR/target/lambda/$lambda/bootstrap.zip" | grep -q 'pdfium-lib/linux/libpdfium.so' \
+ || { echo "document_text_extractor bootstrap.zip is missing pdfium-lib/linux/libpdfium.so" >&2; exit 1; }
+ fi
done
tar -C "$OUTPUT_DIR" -czf lambda-artifacts.tar.gz target
diff --git a/flake.nix b/flake.nix
index 22632f9501..2b9061b860 100644
--- a/flake.nix
+++ b/flake.nix
@@ -547,6 +547,14 @@
cp "target/${lambdaTarget}/release/${lambdaName}" bootstrap
${pkgs.binutils}/bin/strip bootstrap || true
${pkgs.zip}/bin/zip -j -X "$out/${lambdaName}/bootstrap.zip" bootstrap
+ ${pkgs.lib.optionalString (lambdaName == "document_text_extractor") ''
+ # Mirror the handler justfile's `cargo lambda build --include
+ # ./pdfium-lib/linux`: at runtime the binary dlopen's
+ # ./pdfium-lib/linux/libpdfium.so relative to the Lambda task
+ # root, so the blob has to ride along in bootstrap.zip at that
+ # same relative path.
+ ( cd ${lambdaName} && ${pkgs.zip}/bin/zip -r -X "$out/${lambdaName}/bootstrap.zip" pdfium-lib/linux )
+ ''}
${pkgs.lib.optionalString (lambdaName == "call_recording_preview_handler") ''
cp "${callRecordingPreviewFfmpegLayer}/${lambdaName}/ffmpeg-layer.zip" "$out/${lambdaName}/ffmpeg-layer.zip"
''}