pinpoint-apm/pinpoint · warning · ResponseStatusException

there should be ruleId and webhookId to insert webhookSendIn

Error message

there should be ruleId and webhookId to insert webhookSendInfo

What it means

WebhookSendInfoController.insertWebhookSendInfo links an alarm rule to a webhook, so both ruleId and webhookId must be present in the POST body. When either is missing or empty, it throws HTTP 400 before calling webhookSendInfoService.insertWebhookSendInfo, since a link row without both keys cannot be created.

Source

Thrown at webhook/src/main/java/com/navercorp/pinpoint/web/webhook/controller/WebhookSendInfoController.java:44

@RestController
@RequestMapping(value={"/api/webhookSendInfo", "/api/application/webhookSendInfo"})
public class WebhookSendInfoController {
    private final Logger logger = LogManager.getLogger(this.getClass());

    public final static String WEBHOOK_ID = "webhookId";
    public final static String RULE_ID = "ruleId";

    private final WebhookSendInfoService webhookSendInfoService;

    public WebhookSendInfoController(WebhookSendInfoService webhookSendInfoService) {
        this.webhookSendInfoService = Objects.requireNonNull(webhookSendInfoService, "webhookSendInfoService");
    }


    @PostMapping()
    public WebhookSendInfoResponse insertWebhookSendInfo(@RequestBody WebhookSendInfo webhookSendInfo) {
        if (!StringUtils.hasText(webhookSendInfo.getRuleId()) || !StringUtils.hasText(webhookSendInfo.getWebhookId())) {
            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "there should be ruleId and webhookId to insert webhookSendInfo");
        }
        String webhookSendInfoId = webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
        return new WebhookSendInfoResponse(Result.SUCCESS, webhookSendInfoId);
    }

    @DeleteMapping()
    public Response deleteWebhookSendInfo(@RequestBody WebhookSendInfo webhookSendInfo) {
        if (!StringUtils.hasText(webhookSendInfo.getWebhookSendInfoId())) {
            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "there should be webhookSendInfoId to delete webhook");
        }
        webhookSendInfoService.deleteWebhookSendInfo(webhookSendInfo);
        return SimpleResponse.ok();
    }

    @GetMapping()
    public List<WebhookSendInfo> getWebhookSendInfo(@RequestParam(value=WEBHOOK_ID, required=false) String webhookId,
                                                    @RequestParam(value=RULE_ID, required=false) String ruleId) {
        if (!StringUtils.hasText(webhookId) && !StringUtils.hasText(ruleId)) {

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Include both non-empty fields in the POST body: {"ruleId":"<alarmRuleId>","webhookId":"<webhookId>","webhookSendInfoId":null}
  2. Create/get the alarm rule id first via the alarm rule API if unknown
  3. Create/get the webhook id first via GET /webhook if unknown
  4. Check JSON key casing matches the WebhookSendInfo DTO (ruleId, webhookId)

Example fix

// before
{"ruleId":"r-123"}
// after
{"ruleId":"r-123","webhookId":"e2f1a3b4c5d6"}
Defensive patterns

Strategy: validation

Validate before calling

function canInsertWebhookSendInfo(x) { return Boolean(x && x.ruleId?.trim() && x.webhookId?.trim()); }

Type guard

function hasRuleAndWebhookIds(x) { return typeof x.ruleId === 'string' && x.ruleId.length > 0 && typeof x.webhookId === 'string' && x.webhookId.length > 0; }

Try / catch

try { await api.insertWebhookSendInfo(body); } catch (e) { if (e.response?.status === 400 && e.response?.data?.message?.includes('ruleId and webhookId')) { /* resolve missing id, then retry */ } throw e; }

Prevention

When it happens

Trigger: POST /webhookSendInfo with body missing ruleId, missing webhookId, or containing empty strings for either; wrong key casing (rule_id/webhook_id) leaving the DTO fields null.

Common situations: UI automation that creates the rule and webhook asynchronously and posts the link before ids are available; payloads copied from the Webhook controller (which uses webhookId only) missing ruleId; nulls after a failed rule creation.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/fb1a0200cee84ecb. Report an issue: GitHub.