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
}
}
}
})
});