From 9c3a109d775d4b7a1a149a69699f831dd05c0d1b Mon Sep 17 00:00:00 2001 From: Jona Date: Thu, 5 Oct 2023 13:20:52 -0400 Subject: [PATCH] Bug workaround urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017' --- .../lambda_sentinel1_subscription/handler.py | 16 ++++++++++++---- stack/sns_subscription.py | 1 - 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cerulean_cloud/lambda_sentinel1_subscription/handler.py b/cerulean_cloud/lambda_sentinel1_subscription/handler.py index 849af7e3..9777d042 100644 --- a/cerulean_cloud/lambda_sentinel1_subscription/handler.py +++ b/cerulean_cloud/lambda_sentinel1_subscription/handler.py @@ -1,12 +1,20 @@ """handler for SNS topic, to cloud function""" +import json import os - -import requests +from http.client import HTTPSConnection def lambda_handler(event, context): """handle lambda""" function_url = os.getenv("FUNCTION_URL") + domain, path = function_url.replace("https://", "").split("/", 1) print(event) - res = requests.post(function_url, json=event) - return {"statusCode": res.status_code} + conn = HTTPSConnection(domain) + conn.request( + "POST", + "/" + path, + body=json.dumps(event), + headers={"Content-Type": "application/json"}, + ) + res = conn.getresponse() + return {"statusCode": res.status} diff --git a/stack/sns_subscription.py b/stack/sns_subscription.py index d4a0936a..f89bf61b 100644 --- a/stack/sns_subscription.py +++ b/stack/sns_subscription.py @@ -37,7 +37,6 @@ "FUNCTION_URL": cloud_function_scene_relevancy.fxn.https_trigger_url }, ), - layers=["arn:aws:lambda:eu-central-1:770693421928:layer:Klayers-p38-requests:15"], ) # Give SNS permissions to invoke the Lambda lambda_permission = aws.lambda_.Permission(