fix(lambda): resolve handler paths with a leading "./" against the package (#1575)

A Node/file-based handler can be given with a leading "./" — e.g.
"./v1/lambda-handlers/entry.handler", as the terraform-aws-modules/lambda module
(and DPS) emit. resolveHandlerFilePath stripped only the ".handler" export
suffix, leaving "./v1/lambda-handlers/entry", which never matched the
deployment-package entry "v1/lambda-handlers/entry.js" (stored without the
"./"). CreateFunction then rejected the function with
"Handler file '...' not found in deployment package".

Normalize a leading "./" away before matching the handler against the package.
This commit is contained in:
Alex Banna authored and GitHub committed 2026-06-25 18:04:25 -05:00
1 parent ad1cc22c19
commit 0a806f7382
2 files changed
+43

No files matched your search

@@ -1201,6 +1201,12 @@ public class LambdaService {
if (fn.getRuntime().startsWith("python")) {
return modulePath.replace('.', '/');
}
// A file-based handler may be given with a leading "./" (e.g.
// "./v1/lambda-handlers/entry.handler"); deployment-package entries are stored without
// it, so normalize the prefix away before matching.
if (modulePath.startsWith("./")) {
modulePath = modulePath.substring(2);
}
return modulePath;
}