From 07c5678bd1934af716711dbb7879fd378fe40ce5 Mon Sep 17 00:00:00 2001 From: cyberavyss <139671966+cyberavyss@users.noreply.github.com> Date: Tue, 8 Jul 2025 19:40:55 +0300 Subject: [PATCH] Syncronously create the symlink to the requirements layer zip Currently, the symlink is created asynchronously. On a 14-CPUs MacBook Pro the current code leads to a raise condition - the symlink not yet existing during subsequent attempy to use it, but existing afterward. This happens in ~90% of the invocations: Serverless: Packaging Python Requirements Lambda Layer... Serverless: Found cached Python Requirements Lambda Layer file Exception ----------------------------------------------- OperationalError: ENOENT: no such file or directory, open '/Users/XXXX/git/YYYY/.serverless/pythonRequirements.zip' Patching the code locally as proposed, fixes the problem. Also, making the symlinkSync() call will be consistent with making the copySync() call in the adjacent if(...) statement branch. --- lib/layer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/layer.js b/lib/layer.js index 6fe9ca4c..b7d7decb 100644 --- a/lib/layer.js +++ b/lib/layer.js @@ -51,7 +51,7 @@ function zipRequirements() { if (process.platform === 'win32') { fse.copySync(zipCachePath, targetZipPath); } else { - fse.symlink(zipCachePath, targetZipPath, 'file'); + fse.symlinkSync(zipCachePath, targetZipPath, 'file'); } } });