Firewall REST api giving issues

I keep getting the error:

{“error”:{“code”:“bad_request”,“message”:“Invalid request: action should be equal to constant.”}}

I can’t seem to figure out why rules.insert isn’t correct?

Here is my request:

await fetch("https://api.vercel.com/v1/security/firewall/config?projectId=YOUR_PROJECT_ID", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_TOKEN"
  },
  body: JSON.stringify({
    action: "rules.insert",
    id: "unique-rule-id",
    value: {
      active: true,
      conditionGroup: [
        {
          conditions: [
            {
              type: "user_agent",
              op: "re",
              value: "bot|spider"
            }
          ]
        }
      ],
      action: {
        mitigate: {
          action: "deny",
          actionDuration: 3600
        }
      }
    }
  })
});

Hi, @advany! Welcome :slight_smile:

Did you manage to figure out why you were seeing this issue?

I also wanted to cross-post one of our upcoming events as it is be relevant to the Firewall.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.