You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unsupported content type: binary/octet-stream when using aws-sdk Lambda.invoke #591
After generating a toy example using sam init and spinning a local lambda endpoint using sam local start-lambda, I get the following error when trying to invoke the lambda from node using aws-sdk. Say my lambda function is named: HelloWorldFunction. I have the following main.js file:
@jeremie-stratumn Thanks for the report. Looks like different SDKs send different headers, which I was not aware of. I was trying to get fancy here and constrain the request to be 'application/json'. It seems that as long as the request is json, it doesn't matter (I tried your example with invoke a deployed lambda function).
I think we should just remove this header check. We are already checking to see if the request data is json.
Would you be willing to contribute the fix (with updating all the respective tests)?
Thanks @jfuss for getting back to me on this. I would be glad to help! So it's just a matter of removing this check and fixing the tests right? I'll send you a PR.
@jeremie-stratumn That seems to be all. This will relate the checks we do and get us more inline with what the Lambda Service does.
We should just update this functional test to pass, which should cover the use-case you ran into with the node sdk and help catch future regressions in the future.
If you need help in some way, feel free to ping me on slack or the #samdev channel.
Activity
jfuss commentedon Jul 31, 2018
@jeremie-stratumn Thanks for the report. Looks like different SDKs send different headers, which I was not aware of. I was trying to get fancy here and constrain the request to be 'application/json'. It seems that as long as the request is json, it doesn't matter (I tried your example with invoke a deployed lambda function).
I think we should just remove this header check. We are already checking to see if the request data is json.
Would you be willing to contribute the fix (with updating all the respective tests)?
jrmdayn commentedon Aug 1, 2018
Thanks @jfuss for getting back to me on this. I would be glad to help! So it's just a matter of removing this check and fixing the tests right? I'll send you a PR.
Cheers
jfuss commentedon Aug 1, 2018
@jeremie-stratumn That seems to be all. This will relate the checks we do and get us more inline with what the Lambda Service does.
We should just update this functional test to pass, which should cover the use-case you ran into with the node sdk and help catch future regressions in the future.
If you need help in some way, feel free to ping me on slack or the #samdev channel.
jfuss commentedon Aug 6, 2018
Waiting for release, updating labels.
Thanks again @jeremie-stratumn for the PR :)
jrmdayn commentedon Aug 7, 2018
No worries!
jfuss commentedon Aug 29, 2018
Closing this as it was released in 0.6.0