CloudFront Lambda#Edge not seeing custom headers in viewer request - amazon-cloudfront

I have a CloudFront distribution with a Lambda#Edge function which handles viewer request event. I want to send some custom headers and have them processed by Lambda#Edge, however Lambda function doesn't see them. For example I tried to send following headers:
X-Abc-Me
X-Some-Strange-Header
In the event received by Lambda function above headers are not included in 'headers'.
I've tried to look through CloudFront document but don't see any clue yet.
Please help. Thanks a lot in advance.

Related

(Asana) XML is invalid: Headers are not supported on this surface

I am pretty sure I am using exactly the same code in the following two cases, as I tested it on Postman first.
The first time I tried to create a task from Postman, it has no issue.
The next time I tried to do the same from my NodeJS server, and it shows this error. I tried the client SDK package and manually calling through Axios, both are not working and throwing the same error.
Is the Asana API not callable from NodeJS server?
It turns out the "Headers" does not indicate the Headers sent with the request, but the "Headers" HTML Element inside the rich text field. Ensure there's no h1-h6 element in your html_notes can solve this issue.

Azure functions Response Body is missing in Logic Apps

I am processing data from Event Hub. Whenever events are available in event hub series of azure functions are called sequentially to processes the data.
function A is using event data as input --> function B is using output of function A as an input and likewise 2 more functions are there.
Response body is missing in only one function (same, ex.: function B in picture) in some iterations.
Sometimes response body for one of the azure function is missing however response code is 200. I have logged the response body in azure function before returning the response and it(response body) is present in logs.
What can be the reason of not getting the response body.
In the attached image Function B is having this issue.
Update: After adding concurrency control to 1(So that it runs sequentially) issue is resolved however again after removing concurrency control issue is coming. What can be the issue ?
One of the workaround you can follow to resolve the above issue,
Make sure that all of the azure function has been created in the same region that might be the reason for not getting the request body for one function and getting for others.
Would suggest you to create Azure logic app and functions in the same region.
Another workaround is to provide the content type in your event hub to application/json if still having the same the try to set text/plain.
For more information please refer this MICROSOFT DOCUMENTATION| Receive and respond to inbound HTTPS requests in Azure Logic Apps
For the similar issue please refer this MS Q&A| Http Webhook Outputs does not have body content, only headers .

Error 400 Invalid request with upload url but file is properly send to sharepoint

I try to send a file to sharepoint using the Microsoft Graph API resumable file upload :
First, I create my upload session POST: https://graph.microsoft.com/v1.0/me/drive/root:/{itemid}/createUploadSession and I get my upload url, no problem here.
I call my upload url PUT: https://xxx-my.sharepoint.com/personal/xxx_onmicrosoft_com/_api/v2.0/drive/items/xxxxxxxxxx/uploadSession?guid='xxxx'&overwrite=True&rename=False&dc=0&tempauth=xxx with some parameters: Content-Length and Content-Range
I get this error, code 400 : {"error":{"code":"invalidRequest","message":"Invalid request"}} but if I take a look to my sharepoint, the upload did create it! I tried to add or remove parameters, change PUT to POST but of course, it's not working (got DeferCommit was set to false for this upload session., which seems to be normal if I call the upload url with POST).
If I look to the error message, I just have Bad Request with no more informations. I don't know what I'm doing wrong or what I'm missing. If you have some insights, please do tell!!
I found what was missing! I need to add this header to my request: Accept with the value application/json. Now it works like a charm!

AWS Lambda response not in TwiML format

I've been following this tutorial in order to set up a lambda function that replies to incoming texts from a Twilio webhook. The function seems to be working fine and receiving the text data, but when it passes the TwiML back to Twilio there's some kind of formatting issue. I'm getting a 12200 - Schema validation warning in the Twilio error log but I can't for the life of me find the issue with the TwiML. The message says:
WARN "Content is not allowed in prolog." at line 1, cols 1.
I've set up the API Gateway with the proper settings as stated in the tutorial. The Integration Request mapping template is set to application/x-www-form-urlencoded and the Integration Response and Method Response templates are set to application/xml.
My lambda function is:
def lambda_handler(event, context):
return '<?xml version="1.0" encoding="UTF-8"?><Response><Message><Body>Sorry, the command is invalid.</Body></Message></Response>'
This is the response I get when I send a request from Postman. There is a quotation and a newline character before the <?xml which appears to be the problem but as you can see in the lambda_handler() above, I don't believe I'm returning any quotations or \n.
"
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Response>
<Message>
<Body>Sorry, the command is invalid.</Body>
</Message>
</Response>"
Any help with returning XML in python or setting up the Lambda API Gateway would be appreciated as it appears that's where the problem lies.
So it turns out, it was an issue with the API Gateway after all. I had it set up properly, but didn't deploy it correctly so all the changes I was making were not being implemented. Make sure your API Gateway is deployed so your mapping templates actually take effect!

How to upload audio file to s3 via api gateway?

I created an API in API Gateway to upload audio files to s3, the file is sending from local PC as multipart/form-data.
API integration request is shown below
In URL Path Parameters, added bucket as param and directly added the bucket name
When I try to upload the file I get an error response,
body: '<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>InvalidArgument</Code><Message>x-amz-content-sha256 must be UNSIGNED-PAYLOAD, STREAMING-AWS4-HMAC-SHA256-PAYLOAD, or a valid sha256 value.</Message><ArgumentName>x-amz-content-sha256</ArgumentName><ArgumentValue>null</ArgumentValue><RequestId>123445667788</RequestId><HostId>abcd/Jefgh2272vb/ghvsvds+gh+6273gdhsg+gdgshdshdsjdsj=</HostId></Error>'
What are the changes need to be done?
After some research, I found some very useful document
please go through this if you also face the same probem!!
added multipart/form-data to binary support in api.

Resources