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(