-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Lambda Proxy Integration produces Execution failed due to configuration error: Malformed Lambda proxy response #534
Comments
Hi, could you clarify what the problem is? (when do you see a problem? do you have an example?) Bref is already handling multi-value headers: Lines 336 to 348 in ad29b00
|
I'm not using multiValueHeaders, so far I can see in the code, the Lambda should return just headers, but it doesn't. Anyway...this is not the real problem. The real problem is the format of the {
"isBase64Encoded": false,
"statusCode": 200,
"multiValueHeaders": {
"x-powered-by": "PHP/7.4.0",
"cache-control": "no-cache, private",
"date": "Fri, 17 Jan 2020 17:18:01 GMT",
"content-type": "application/json",
"x-ratelimit-limit": "60",
"x-ratelimit-remaining": "59"
},
"body": "{}"
} which is wrong, because the multi header values are strings and not array of strings. |
Could you explain a bit more about your project? For example:
Since I have little information one possibility I consider here is that you are not using the PHP-FPM layer and you are creating the response yourself, which is why nothing works the way it should. This is why I want to clear this up. |
Hi,
and here is my serverless.yml service: my-rest-api
provider:
name: aws
region: eu-central-1
runtime: provided
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
stage: dev
package:
exclude:
- '.git/**'
- 'node_modules/**'
- 'storage/**'
plugins:
- ./vendor/bref/bref
functions:
booking:
handler: public/index.php
description: 'Laravel implementation of My REST API'
layers:
- ${bref:layer.php-74-fpm} and here is how the response is generated in the Laravel controller: return response()
->json(new \stdClass(), 200, []); |
Thanks, just before I dig more into this is there any reason you didn't let serverless.yml create and configure API Gateway for you? |
The only one reason is, that the API Gateway is configured by it's own CloudFormation template and uses different beckends - currently Java and now I'm implementing some services as PHP serverless application with Laravel. I'm new to the serverless framework, and don't realy know how it will co-work with my existing CF templates. It's something I'll investigate later. |
I'ts exactley the same. |
What error do you see? |
Here the log from the API GW
|
It's looks like, that the problem here happens only when testing the Lamda invocation from the API Gateway Console. When the API Gateway is configured and the call is propagated to the Lamda functioin, everything works like expected. The difference is, that the API Gateway sends to the Lamda Function a
When calling the Lamda function from the test API Gateway Console, it sends just a single value header list. Why this results in a muty-value header list in the response is not clear for me - here the log from the console:
|
Oh well spotted! Just to be sure I understand:
that's correct? If it is, I'm not really sure I want to spend time working on this to be honest 😅 |
Yes, |
@gerdzhikov OK I've managed to reproduce this in another scenario. I will be pushing a fix at some point. Thank you for reporting this. |
Thank you for fixing this! |
It's seems, that the AWS Lambda documentation is not 100% corrrect:
but, they must be formated as multi values e.g.
x-my-custom-header: ["Singel Value"]
, if the response contains themultiValueHeaders
key, they must be provided as arrays of single valuesThis seems to be correct
but this doesn't work
How can I force bref to use
headers
and notmultiValueHeaders
? This could be a dirty hotfix for me?The text was updated successfully, but these errors were encountered: