Skip to content

Commit f110408

Browse files
hassyclaude
andcommitted
fix: expose lambda handler files via node_modules symlinks
aws-lambda-ric invokes the handler as a bare specifier — "a9-handler-index" — and Node resolves bare names only through node_modules. Our handler files live at /artillery/a9-handler-*.js, unreachable that way. The previous bookworm-slim build appears to have cached an older aws-lambda-ric whose fallback path.resolve logic tolerated this; the DHI build pulls a newer version that doesn't. Symlink each of the three handler files into /artillery/node_modules/. Node follows the symlinks and uses the target's directory as __dirname, so the relative require('./a9-handler-helpers') calls inside the handler continue to resolve. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a323d61 commit f110408

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • packages/artillery/lib/platform/aws-ecs/worker

packages/artillery/lib/platform/aws-ecs/worker/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ COPY --from=builder ${FUNCTION_DIR}/a9-handler-dependencies.js ${FUNCTION_DIR}/
216216
COPY --from=builder ${FUNCTION_DIR}/a9-handler-helpers.js ${FUNCTION_DIR}/
217217
COPY --from=builder ${FUNCTION_DIR}/a9-handler-index.js ${FUNCTION_DIR}/
218218

219+
# aws-lambda-ric invokes the handler as a bare specifier ("a9-handler-index").
220+
# Node resolves bare names only via node_modules, so the files at /artillery/
221+
# aren't reachable without help. Expose each handler file inside node_modules
222+
# as a symlink — Node follows the symlink and treats the target dir
223+
# (/artillery) as __dirname, so the relative require('./a9-handler-helpers')
224+
# calls inside the handler still resolve.
225+
RUN ln -s /artillery/a9-handler-index.js /artillery/node_modules/a9-handler-index.js \
226+
&& ln -s /artillery/a9-handler-helpers.js /artillery/node_modules/a9-handler-helpers.js \
227+
&& ln -s /artillery/a9-handler-dependencies.js /artillery/node_modules/a9-handler-dependencies.js
228+
219229
# Fargate worker scripts — copied from the build context (not builder stage)
220230
# because they may change independently of npm dependencies.
221231
COPY ./packages/artillery/lib/platform/aws-ecs/worker/loadgen-worker /artillery/loadgen-worker

0 commit comments

Comments
 (0)