SAM Doctor

ERROR REFERENCE

Lambda could not find the invoke target

The Lambda Invoke call reached AWS, but the requested function, alias, or published version was not present in the account and Region used by the caller. Check the target before changing IAM.

WHAT IT MEANS

What this error means

An error occurred (ResourceNotFoundException) when calling the Invoke operation

This is often a post-deploy smoke test using a stale function name, alias, Region, or account. It can also run before an alias or version finishes becoming available. The line alone does not prove that the CloudFormation deployment itself failed.

NEXT CHECK

Verify the exact target

  1. Read the function directly in the same account and Region:
    aws lambda get-function --function-name <function-name> --qualifier <alias-or-version>
    Omit --qualifier when the invoke did not specify one.
  2. Compare the name and qualifier with the deploy output. Check the stack output or transformed template, especially when SAM created an AutoPublishAlias or a new version.
  3. Check deployment timing. Wait for the stack and alias resources to complete before the smoke test retries. If the target still does not exist, correct the Region, account, function name, or qualifier rather than broadening permissions for a missing resource.

AUTOMATE THE TRIAGE

Keep the check in your normal workflow

SAM Doctor recognizes the Lambda Invoke operation with medium confidence and points at a read-only function and qualifier check. Runs locally; no AWS access, no log upload.

python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown

RELATED