-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Description
📜 Description
when triggering an event, on a workflow with payload validation (/v1/events/trigger
) an error is thrown when a field has a null
value, even if the field is marked as optional:
sending a payload without errorMessage
will throw:
{"errors":[{"field":"errorMessage","message":"must be string","value":null,"schemaPath":"#/properties/errorMessage/type"}],"schema":{"type":"object","properties":{"email":{"type":"string"},"sourceOrganizationName":{"type":"string"},"targetOrganizationName":{"type":"string"},"isSuccess":{"type":"boolean"},"errorMessage":{"type":"string"}},"required":["email","sourceOrganizationName","targetOrganizationName","isSuccess"]},"type":"PAYLOAD_VALIDATION_ERROR","statusCode":400,"timestamp":"2025-10-02T12:19:59.513Z","path":"/v1/events/trigger","message":"Payload validation failed: errorMessage: must be string","ctx":{"errors":[{"field":"errorMessage","message":"must be string","value":null,"schemaPath":"#/properties/errorMessage/type"}],"schema":{"type":"object","properties":{"email":{"type":"string"},"sourceOrganizationName":{"type":"string"},"targetOrganizationName":{"type":"string"},"isSuccess":{"type":"boolean"},"errorMessage":{"type":"string"}},"required":["email","sourceOrganizationName","targetOrganizationName","isSuccess"]},"type":"PAYLOAD_VALIDATION_ERROR"}}
Shouldn't it pass validation?
👟 Reproduction steps
- Set up a workflow with payload schema validation, with an optional field
- Trigger workflow with null value on optional field
👍 Expected behavior
It should pass validation
👎 Actual Behavior with Screenshots
It fails:
{"errors":[{"field":"errorMessage","message":"must be string","value":null,"schemaPath":"#/properties/errorMessage/type"}],"schema":{"type":"object","properties":{"email":{"type":"string"},"sourceOrganizationName":{"type":"string"},"targetOrganizationName":{"type":"string"},"isSuccess":{"type":"boolean"},"errorMessage":{"type":"string"}},"required":["email","sourceOrganizationName","targetOrganizationName","isSuccess"]},"type":"PAYLOAD_VALIDATION_ERROR","statusCode":400,"timestamp":"2025-10-02T12:19:59.513Z","path":"/v1/events/trigger","message":"Payload validation failed: errorMessage: must be string","ctx":{"errors":[{"field":"errorMessage","message":"must be string","value":null,"schemaPath":"#/properties/errorMessage/type"}],"schema":{"type":"object","properties":{"email":{"type":"string"},"sourceOrganizationName":{"type":"string"},"targetOrganizationName":{"type":"string"},"isSuccess":{"type":"boolean"},"errorMessage":{"type":"string"}},"required":["email","sourceOrganizationName","targetOrganizationName","isSuccess"]},"type":"PAYLOAD_VALIDATION_ERROR"}}

Novu version
Novu EU Saas
npm version
No response
node version
No response
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find a similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to submit PR?
Yes I am willing to submit a PR!