src/Runtime/LambdaRuntime.php
public function failInitialization(string $message, ?\Throwable $error = null): void
    {
        // Log the exception in CloudWatch
        echo "$message\n";
        if ($error) {
            if ($error instanceof \Exception) {
                $errorMessage = get_class($error) . ': ' . $error->getMessage();
            } else {
                $errorMessage = $error->getMessage();
            }
            printf(
                "Fatal error: %s in %s:%d\nStack trace:\n%s",
                $errorMessage,
                $error->getFile(),
                $error->getLine(),
                $error->getTraceAsString()
            );
        }

        $url = "http://{$this->apiUrl}/2018-06-01/runtime/init/error";
        $this->postJson($url, [
            'errorMessage' => $message . ' ' . ($error ? $error->getMessage() : ''),
            'errorType' => $error ? get_class($error) : 'Internal',
            'stackTrace' => $error ? explode(PHP_EOL, $error->getTraceAsString()) : [],
        ]);

        exit(1);
    }
public function failInitialization(string $message, ?\Throwable $error = null): void
    {
        // Log the exception in CloudWatch
        echo "$message\n";
        if ($error) {
            if ($error instanceof \Exception) {
                $errorMessage = get_class($error) . ': ' . $error->getMessage();
            } else {
                $errorMessage = $error->getMessage();
            }
            printf(
                "Fatal error: %s in %s:%d\nStack trace:\n%s",
                $errorMessage,
                $error->getFile(),
                $error->getLine(),
                $error->getTraceAsString()
            );
        }

        $url = "http://{$this->apiUrl}/2018-06-01/runtime/init/error";
        $this->postJson($url, [
            'errorMessage' => $message . ' ' . ($error ? $error->getMessage() : ''),
            'errorType' => $error ? get_class($error) : 'Internal',
            'stackTrace' => $error ? explode(PHP_EOL, $error->getTraceAsString()) : [],
        ]);

        exit(1);
    }
public function failInitialization ( string $ message , ? \ Throwable $ error = null ) : void { // Log the exception in CloudWatch echo "$message\n" ; if ( $ error ) { if ( $ error instanceof \ Exception ) { $ errorMessage = get_class ( $ error ) . ': ' . $ error -> getMessage ( ) ; } else { $ errorMessage = $ error -> getMessage ( ) ; } printf ( "Fatal error: %s in %s:%d\nStack trace:\n%s" , $ errorMessage , $ error -> getFile ( ) , $ error -> getLine ( ) , $ error -> getTraceAsString ( ) ) ; } $ url = "http://{$this->apiUrl}/2018-06-01/runtime/init/error" ; $ this -> postJson ( $ url , [ 'errorMessage' => $ message . ' ' . ( $ error ? $ error -> getMessage ( ) : '' ) , 'errorType' => $ error ? get_class ( $ error ) : 'Internal' , 'stackTrace' => $ error ? explode ( PHP_EOL , $ error -> getTraceAsString ( ) ) : [ ] , ] ) ; exit ( 1 ) ; }
Abort the lambda and signal to the runtime API that we failed to initialize this instance.

@see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html#runtimes-api-initerror
Abort the lambda and signal to the runtime API that we failed to initialize this instance .