Skip to content

Lambda: invoke returns FunctionError='' on success; AWS omits the key #393

Closed

Description

@scttfrdmn

Summary

lambda.invoke returns FunctionError: "" (empty string) on a successful
invocation. AWS omits the key entirely when the function did not error.

Reproduction

lam.create_function(FunctionName="fn", Runtime="python3.12",
                    Role="arn:aws:iam::123456789012:role/r",
                    Handler="index.handler", Code={"ZipFile": ...})
r = lam.invoke(FunctionName="fn", InvocationType="RequestResponse")
print("FunctionError" in r)   # substrate: True, value ''
                              # AWS:       False

Full response keys from substrate 0.76.0:

{'ExecutedVersion': '$LATEST', 'FunctionError': '', 'LogResult': '...', 'Payload': ..., 'StatusCode': 200}

Expected

FunctionError present only on Handled/Unhandled, per the InvokeResponse
documentation. Also note LogResult is returned unconditionally here; AWS returns
it only when LogType="Tail" was requested.

Why it matters

Low severity — the idiomatic check is truthiness, and "" is falsy:

if response.get("FunctionError"):      # correct against both
    raise LambdaFunctionError(...)

But if "FunctionError" in response: is a natural and reasonably common spelling,
and it inverts against substrate: every successful invocation looks like a failure.
It also makes the honest assertion in an emulator-conformance test
(assert "FunctionError" not in response) fail, which is how I found it.

Activity

  1. added
    type: bug
    priority: low
    on Jul 30, 2026
  2. added this to the v0.78.0 milestone on Jul 31, 2026
  3. added a commit that references this issue on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: lambdapriority: lowtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions