haaska
haaska copied to clipboard
`make discover` causes Invalid base64 error [FIX OFFERED]
When using make discover
to test from a local system, an Invalid base64
error is returned from AWS.
This is also true when running the make command manually and is due to the inbound payload being raw JSON.
Not being an expert on either Makefile's or the invocation parameters of Lambda from the AWS CLI tool - I didnt want to raise a PR to fix this in the makefile, but offer up the solution here as I do not know the effect this change might have on other opereating systems or environments.
The link below states 'If you are on windows' - but I am working on OSX, but it still worked.
Basically the 'fix' was to add the following line into the discover
task in the makefile:
--cli-binary-format=raw-in-base64-out \
The whole task then looks like:
discover:
@aws lambda invoke \
--function-name $(FUNCTION_NAME) \
--cli-binary-format=raw-in-base64-out \
--payload ${DISCOVERY_PAYLOAD} \
/dev/fd/3 3>&1 >/dev/null | jq '.'
Origin / Reference: https://bobbyhadz.com/blog/aws-cli-invalid-base64-lambda-error