src/Lambda/SimpleLambdaClient.php
public function invoke(string $functionName, $event = null): InvocationResult
    {
        $rawResult = $this->lambda->invoke([
            'FunctionName' => $functionName,
            'LogType' => 'Tail',
            'Payload' => $event ?? '',
        ]);

        /** @var StreamInterface $resultPayload */
        $resultPayload = $rawResult->get('Payload');
        $resultPayload = json_decode($resultPayload->getContents(), true);

        $invocationResult = new InvocationResult($rawResult, $resultPayload);

        $error = $rawResult->get('FunctionError');
        if ($error) {
            throw new InvocationFailed($invocationResult);
        }

        return $invocationResult;
    }
public function invoke(string $functionName, $event = null): InvocationResult
    {
        $rawResult = $this->lambda->invoke([
            'FunctionName' => $functionName,
            'LogType' => 'Tail',
            'Payload' => $event ?? '',
        ]);

        /** @var StreamInterface $resultPayload */
        $resultPayload = $rawResult->get('Payload');
        $resultPayload = json_decode($resultPayload->getContents(), true);

        $invocationResult = new InvocationResult($rawResult, $resultPayload);

        $error = $rawResult->get('FunctionError');
        if ($error) {
            throw new InvocationFailed($invocationResult);
        }

        return $invocationResult;
    }
public function invoke ( string $ functionName , $ event = null ) : InvocationResult { $ rawResult = $ this -> lambda -> invoke ( [ 'FunctionName' => $ functionName , 'LogType' => 'Tail' , 'Payload' => $ event ?? '' , ] ) ; /** @var StreamInterface $resultPayload */ $ resultPayload = $ rawResult -> get ( 'Payload' ) ; $ resultPayload = json_decode ( $ resultPayload -> getContents ( ) , true ) ; $ invocationResult = new InvocationResult ( $ rawResult , $ resultPayload ) ; $ error = $ rawResult -> get ( 'FunctionError' ) ; if ( $ error ) { throw new InvocationFailed ( $ invocationResult ) ; } return $ invocationResult ; }
Synchronously invoke a function.

@param mixed $event Event data (can be null).
@throws InvocationFailed
Synchronously invoke a function .