serverless-openwhisk
serverless-openwhisk copied to clipboard
Openwhisk Returned HTTP 400 (Bad Request) --> "The request content was malformed:
If an environment variable or another default parameter is not properly set then sls deploy
will throw an error. The error that displays is only:
Returned HTTP 400 (Bad Request) --> "The request content was malformed:
However under the covers if you add additional logging you will find.
message:
'PUT https://us-south.functions.cloud.ibm.com/api/v1/namespaces/OURNAMESPACE/actions/add-users?overwrite=true Returned HTTP 400 (Bad Request) --> "The request content was malformed:\nparameters malformed!"',
error:
{ code: '5e5ddc3f2084d2c18cbdbfc66e8665cc',
error: 'The request content was malformed:\nparameters malformed!' },
statusCode: 400 }
I feel like there should be a preflight check fo parameters or at the very least a more verbose error message when this happens as it's not 100% apparent what is causing the error without going into the code and adding a log node_modules/serverless-openwhisk/deployFunction/index.js:70
Hello Michael - can you expand on what you mean by environment variable or another default parameter
not being set? Do you mean the authentication parameters like (__OW_API_HOST
) or something else?
Can you provide a test-case for this and it can get added to the backlog? Adding more verbose error messages or pre-flight checks seems like a good idea. If you want to have a go at a PR - I'd happily review and work on getting it merged.
I have the same error, I just can't figure out what this is about...
Ok got it... I had a typo in my serverless.yml
file under the parameters
object. Specifically, I had something like:
custom:
env: ${file(./${self:provider.stage}.env.json)}
functions:
my_function:
handler: index.handler
parameters:
SECRET_ID: ${self:custom.env.SEGRET_ID}
(note the "G" instead of "C" in self:custom.env.SEGRET_ID
)
Where can I find that file when using faas in IBMCloud ?