From 1bf03705a7ea03fb9dbb09e47277bd5c46258da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Sch=C3=B6n?= <44229844+MaximilianSchon@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:15:09 +0200 Subject: [PATCH] fix: bundling with multiple dots in filename (#1235) --- pkg/runtime/node/build.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/runtime/node/build.go b/pkg/runtime/node/build.go index 5fdaced2c..da2b535ed 100644 --- a/pkg/runtime/node/build.go +++ b/pkg/runtime/node/build.go @@ -43,8 +43,12 @@ func (r *Runtime) Build(ctx context.Context, input *runtime.BuildInput) (*runtim if err != nil { return nil, err } - target := filepath.Join(input.Out(), strings.ReplaceAll(rel, filepath.Ext(rel), extension)) + fileName := strings.TrimSuffix(filepath.Base(rel), filepath.Ext(rel)) + // Lambda handler can only contain 1 dot separating the file name and function name + fileName = strings.ReplaceAll(fileName, ".", "-") + handler := fileName + filepath.Ext(input.Handler) + target := filepath.Join(input.Out(), fileName+extension) slog.Info("loader info", "loader", properties.Loader) loader := map[string]esbuild.Loader{} @@ -229,7 +233,7 @@ func (r *Runtime) Build(ctx context.Context, input *runtime.BuildInput) (*runtim } return &runtime.BuildOutput{ - Handler: input.Handler, + Handler: handler, Errors: errors, }, nil }