node-auth0 icon indicating copy to clipboard operation
node-auth0 copied to clipboard

ActionsManager.updateTriggerBindings works not as documented

Open ykmg opened this issue 3 years ago • 1 comments

Describe the problem

When using the ActionsManager for update trigger bindings as documented, it always throws this error:

{"statusCode":400,"error":"Bad Request","message":"Payload validation error: 'Data does not match any schemas from 'oneOf'' on property bindings[0].","errorCode":"invalid_body"} `

The Payload followed the structure as documented in the example: var data = { bindings: [{ id_type: "action_id", id_value: ACTION_ID1},{id_type: "action_name", id_value: ACTION_NAME2}]};

image

image

What was the expected behavior?

The trigger bindings should be updated accordingly. Alternatively / Additionally a more clear error message would be helpful.

Reproduction

Use the ActionsManager as documented in the example. https://auth0.github.io/node-auth0/ActionsManager.html#updateTriggerBindings


var data = { bindings: [{ id_type: "action_id", id_value: ACTION_ID1},{id_type: "action_name", id_value: ACTION_NAME2}];
var params = { trigger_id: TRIGGER_ID };

// Using auth0 instance.
management.actions.updateTriggerBindings(params, data, function (err, bindings) {
  if (err) {
    // Handle error.
  }

  console.log(bindings.length);  // 2
});

Environment

node v16.15.1 node-auth0 v2.42.0

ykmg avatar Jul 21 '22 13:07 ykmg

Hi @ykmg

Looking at https://auth0.com/docs/api/management/v2#!/Actions/patch_bindings

Could you try:

var data = {
  "bindings": [
    {
      "ref": {
        "type": "action_id",
        "value": ACTION_ID1
      }
    },
    {
      "ref": {
        "type": "action_name",
        "value": ACTION_NAME2
      }
    }
  ]
}

If it works I'll update the docs.

adamjmcgrath avatar Jul 29 '22 15:07 adamjmcgrath

Closing due to inactivity, ping me if you want to reopen

adamjmcgrath avatar Sep 13 '22 07:09 adamjmcgrath