Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Openwhisk Returned HTTP 400 (Bad Request) --> "The request content was malformed: #181

Open
michaelwclark opened this issue Jul 15, 2019 · 4 comments

Comments

@michaelwclark
Copy link

michaelwclark commented Jul 15, 2019

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

@jthomas
Copy link
Contributor

jthomas commented Jul 16, 2019

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.

@Jonarod
Copy link

Jonarod commented Sep 12, 2019

I have the same error, I just can't figure out what this is about...

@Jonarod
Copy link

Jonarod commented Sep 12, 2019

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)

@amitabhprasad
Copy link

Where can I find that file when using faas in IBMCloud ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants