You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title
feat: pull invokeLambdaForTesting + invokeHandlerForTesting into the sdk (off aws-sdk v2) description
feat(sdk-aws-lambda): pull the lambda-testing utils into the sdk
.what
pull the lambda test-invoke utils that today live in simple-lambda-testing-methods into sdk-aws-lambda itself, so a consumer of the sdk gets one home for both the runtime invoke and
the test invoke:
invokeLambdaForTesting({ service, function, stage, locally, event }) β invoke a live deployed
lambda (or, with locally: true, the in-process handler via the serverless.yml handler path).
invokeHandlerForTesting({ handler, event }) β invoke a callback-pattern handler with
async/await, for unit/integration tests.
.why
one sdk, one home β a consumer already reaches for sdk-aws-lambda for the runtime invoke;
the test invoke sits beside it, not in a separate simple-lambda-testing-methods package a
consumer must discover independently.
share the invoke client + name computation β invokeLambdaForTesting builds the deployed
function name from { service, function, stage } and invokes via a lambda client. that name
computation + client is exactly what the sdk owns; a fork of it in a testing package invites
drift (the two can disagree on how a function is named).
the aws-sdk version is a shared concern β the testing package currently pulls aws-sdk
v2 under the hood (via simple-lambda-client), which has no SSO-profile support and hangs on
IMDS for a dev-machine invoke (this bit us on ahbode/svc-home-services PR ποΈ task - fix(errors): an absent schema.output is a raw TypeError in three places β refuse at construction and name the fixΒ #30 β the deployed
acceptance grain hung 90s/invoke until creds were exported to env vars). with the invoke client
in the sdk, the sdk owns the aws-sdk version + credential-chain behavior in one place, and a fix
there fixes both runtime and test invoke.
.the ask
expose invokeLambdaForTesting + invokeHandlerForTesting from sdk-aws-lambda (names may be
adjusted to the sdk's verb conventions, e.g. an invoke*/get* form β the point is the util,
not the exact name).
reuse the sdk's own lambda client + function-name computation so the test invoke and the runtime
invoke cannot drift.
on the aws-sdk version: prefer aws-sdk v3 (SSO-profile aware) so the invoke client does not fall
back to IMDS on a dev machine. if v2 must stay for now, document the SSO caveat and the
cred-export workaround the deployer deploy.sh uses.
keep simple-lambda-testing-methods as a thin re-export shim for back-compat, or mark it
deprecated in favor of the sdk export.
.acceptance
a consumer can import { invokeLambdaForTesting } from 'sdk-aws-lambda' (or the sdk's chosen
name) and invoke a deployed lambda + an in-process handler, with no separate testing package.
the test invoke and the runtime invoke share the sdk's function-name computation + lambda client.
the invoke client does not hang on IMDS for an SSO-profile dev-machine invoke (v3), or the SSO
caveat + workaround is documented (v2).
.origin
surfaced as ahbode/svc-home-services (PR #30) built its deployed-acceptance grain on invokeLambdaForTesting from simple-lambda-testing-methods; the aws-sdk-v2 SSO/IMDS hang and the
separate-package discovery cost both pointed at the util's home being sdk-aws-lambda. companion
to the git.repo.test acceptance-cloud cred/ACCESS dispatch (which works around the v2 hang at the
skill layer) and the declapract prep-over-dev dispatches.
π¦«ποΈ dispatch to foreman
title
feat: pull invokeLambdaForTesting + invokeHandlerForTesting into the sdk (off aws-sdk v2)
description
feat(sdk-aws-lambda): pull the lambda-testing utils into the sdk
.what
pull the lambda test-invoke utils that today live in
simple-lambda-testing-methodsintosdk-aws-lambdaitself, so a consumer of the sdk gets one home for both the runtime invoke andthe test invoke:
invokeLambdaForTesting({ service, function, stage, locally, event })β invoke a live deployedlambda (or, with
locally: true, the in-process handler via the serverless.yml handler path).invokeHandlerForTesting({ handler, event })β invoke a callback-pattern handler withasync/await, for unit/integration tests.
.why
sdk-aws-lambdafor the runtime invoke;the test invoke sits beside it, not in a separate
simple-lambda-testing-methodspackage aconsumer must discover independently.
invokeLambdaForTestingbuilds the deployedfunction name from
{ service, function, stage }and invokes via a lambda client. that namecomputation + client is exactly what the sdk owns; a fork of it in a testing package invites
drift (the two can disagree on how a function is named).
v2 under the hood (via
simple-lambda-client), which has no SSO-profile support and hangs onIMDS for a dev-machine invoke (this bit us on
ahbode/svc-home-servicesPR ποΈ task - fix(errors): an absent schema.output is a raw TypeError in three places β refuse at construction and name the fixΒ #30 β the deployedacceptance grain hung 90s/invoke until creds were exported to env vars). with the invoke client
in the sdk, the sdk owns the aws-sdk version + credential-chain behavior in one place, and a fix
there fixes both runtime and test invoke.
.the ask
invokeLambdaForTesting+invokeHandlerForTestingfromsdk-aws-lambda(names may beadjusted to the sdk's verb conventions, e.g. an
invoke*/get*form β the point is the util,not the exact name).
invoke cannot drift.
back to IMDS on a dev machine. if v2 must stay for now, document the SSO caveat and the
cred-export workaround the deployer
deploy.shuses.simple-lambda-testing-methodsas a thin re-export shim for back-compat, or mark itdeprecated in favor of the sdk export.
.acceptance
import { invokeLambdaForTesting } from 'sdk-aws-lambda'(or the sdk's chosenname) and invoke a deployed lambda + an in-process handler, with no separate testing package.
caveat + workaround is documented (v2).
.origin
surfaced as
ahbode/svc-home-services(PR #30) built its deployed-acceptance grain oninvokeLambdaForTestingfromsimple-lambda-testing-methods; the aws-sdk-v2 SSO/IMDS hang and theseparate-package discovery cost both pointed at the util's home being
sdk-aws-lambda. companionto the git.repo.test acceptance-cloud cred/ACCESS dispatch (which works around the v2 hang at the
skill layer) and the declapract prep-over-dev dispatches.