Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws Lambda Client gives SSL connect error #1138

Open
Muhammad-Bilal-31 opened this issue Nov 30, 2021 · 3 comments
Open

Aws Lambda Client gives SSL connect error #1138

Muhammad-Bilal-31 opened this issue Nov 30, 2021 · 3 comments

Comments

@Muhammad-Bilal-31
Copy link

Hi, I'm facing an SSL connect error randomly after some time. When I call the lambda function for more than one request.

Could not contact remote server. {"exception":"[object] (AsyncAws\Core\Exception\Http\NetworkException(code: 0): Could not contact remote server. at /opt/bitnami/projects/ERIC/vendor/async-aws/core/src/Response.php:142)

SSL connect error for "https://lambda.eu-central-1.amazonaws.com/2015-03-31/functions/scanpdf/invocations\". at /opt/bitnami/projects/ERIC/vendor/symfony/http-client/Chunk/ErrorChunk.php:53)

@Muhammad-Bilal-31
Copy link
Author

Should we close lambda client somehow?

@jderusse
Copy link
Member

SSL connection error sounds like an error with your connection. Do you have a reproducer?

Is the trailing \ expected at the end of the URL?

@Muhammad-Bilal-31
Copy link
Author

Muhammad-Bilal-31 commented Nov 30, 2021

I have no reproducer for this scenario. It comes randomly.
The trailing \ is generated by the async-aws/lambda package which we are using in our project.
Basically, I'm calling lambda client in the loop, and every time I'm creating a new lambda client like following:

    public function lambdaCallWithJobId($project_id, $file_name, $job_id,$template)
    {
        $lambda = new LambdaClient([
            'accessKeyId' => env('AWS_ACCESS_KEY_ID'),
            'accessKeySecret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
        ]);

        $data = (object) [
            'ProjectId' => $project_id,
            'PdfName' => $file_name,
            "EventType" => "GetScanResult",
            "PdfTemplate" => $template,
            "TextractJobId" => $job_id

        ];


        $result = $lambda->invoke([
            'FunctionName' => 'scanpdf',
            'Payload' =>  json_encode($data)

        ]);

        $resData =  $result->getPayload();
        $resData = json_decode($resData);
        $lambda->curl_close;
        return $resData;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants