Local Development
Reproduce cloud-only behaviour on your machine. kanject test runs your service locally — picking the right runner from the project type — and --pull-env resolves a stage's real env into the process, so a bug that only appears with production-shaped config is debuggable with local breakpoints.
- Run a service locally — webapi or a Lambda — with
kanject test - Pull a stage's real
param:/secret:env into the local process, safely - Inspect plain values and stored parameter/secret bindings with
kanject env - Attach an IDE and keep launch profiles and VS Code in sync
Run it: kanject test
test reads the manifest runtimeMode (or detects it from the csproj) and launches the matching runner:
webapi—dotnet run(ordotnet watch runwith--watch), on port 5000.lambda-tasks— theAmazon.Lambda.TestToolon port 5050; replay a payload with--event.lambda-aspnetcore— the TestTool by default;--httpflips it to a plain web host.library— no runner; usedotnet test/dotnet rundirectly.
# Run the service locally — webapi runs with dotnet, a Lambda launches the TestToolkanject test# Hot-reload a webapikanject test --watch# Send a Lambda an event payload (from the events/ folder)kanject test --event events/order-created.json# Run an aspnetcore-in-Lambda service as a plain web host instead of the TestToolkanject test --http Real env, locally: --pull-env
--pull-env resolves the stage's param: and secret: references live from Parameter Store and Secrets Manager and injects them into the test process. The values stay in process memory — Kanject never writes them to disk. A summary panel prints the count by source (without the values) before launch.
# Run locally with a stage's real env resolved in — param: and secret:# references pulled live from SSM / Secrets Manager, in memory onlykanject test --pull-env --env dev Inspect env: kanject env
kanject env [--env <stage>] is local-only: it prints each key, source, and stored stage-config value without calling SSM or Secrets Manager. secret: and param: bindings are masked by default; --show-values reveals the binding string, not the remote secret. When stage is omitted on a terminal, the sole stage is selected or a picker appears; scripts must pass it explicitly.
# Omit --env on a terminal to use the sole stage or choose from a pickerkanject env# Reveal the stored binding strings — this still makes no AWS callkanject env --env dev --show-values Debugging and IDE setup
--debug spawns the process so your IDE can attach: it prints the PID and refreshes a kanject-managed "Attach to Kanject TestTool" entry in .vscode/launch.json (your other launch configs are left untouched). --setup-ide writes the IDE profiles and exits without running; --launch-profile <name> picks a specific launchSettings.json profile for scripting.
# Spawn the process so an IDE can attach; prints the PID and# refreshes a .vscode/launch.json "Attach to Kanject TestTool" configkanject test --debug# Write the IDE profiles (.vscode/launch.json + launchSettings.json) and exitkanject test --setup-ide Guidelines
- Pull env from a low-stakes stage.
--pull-env --env devresolves live secrets into your shell — don't point it atprodcasually. - Reach for
kanject envfirst to inspect how a key is bound. It masks references by default and never calls AWS or injects anything into a process; usetest --pull-envwhen you need to verify remote resolution. --watchfor the webapi inner loop,--eventto replay a real payload through a Lambda from theevents/folder.- Run
kanject test --setup-ideonce so teammates get the VS Code attach config and launch profiles without hand-editing JSON. - In a multi-entry repo, run
testfrom the entry's own directory — it resolves the runtime per project.
kanject testruns your service locally, choosingdotnet runfor a webapi or theAmazon.Lambda.TestToolfor a Lambda.--pull-envinjects a stage's realparam:/secret:values into the process, in memory only, with aKANCLI044warning for SecureStrings.kanject envprints local stage bindings, masking parameter and secret references by default; it never fetches their remote values.--debug/--setup-idekeep.vscode/launch.jsonand launch profiles in sync for IDE attach.