I have an AWS lambda function (nodejs) that will return a pdf with Content-Type: "application/pdf".
I learned how to prepare it for deployment in a container image,
and the documentation says i can invoke it locally with
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
,
where the -XPOST seems unnecessary as the function will just read the request body provided by --data/-d even if it's from the default -XGET.
Either way, at this point i'm not processing any request body yet, and i could as well not even intend to, but if i omit the request body (or provide an invalid json like -d "abc"
), the Runtime Interface Client fails before even invoking my function with this error:
{"errorType":"SyntaxError"
,"errorMessage":"Unexpected end of JSON input"
,"trace":
["SyntaxError: Unexpected end of JSON input"
," at JSON.parse (<anonymous>)"
," at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1089:42)"
]}
(or Unexpected token a in JSON at position 0
, for the -d "abc"
)
If i could access the local function url from browser, i could immediately see the returned pdf result, but there's no way to provide a dummy request body there. How do I allow the lambda interface to accept simple get requests without a body?