N
Novuβ€’3w ago
Willem

/v1/event/trigger 400 bad request: trigger is missing: actor object

Hello πŸ‘‹, my api requests towards the /v1/event/trigger endpoint is returning a 400 error code with the message "trigger is missing: actor object". Looking at the documentation, it mentions that actor is not a required object. Did anything change in regards to certain properties being required for this particular endpoint? My payload:
{
"name": "<redacted>",
"to": [
{
"subscriberId": "redacted",
"data": {
"companyId": redacted,
"userId": redacted
},
"email": "redacted",
"firstName": "redacted"
}
],
"payload": {redacted},
},
"overrides": {}
{
"name": "<redacted>",
"to": [
{
"subscriberId": "redacted",
"data": {
"companyId": redacted,
"userId": redacted
},
"email": "redacted",
"firstName": "redacted"
}
],
"payload": {redacted},
},
"overrides": {}
Full response:
{
"statusCode": 400,
"timestamp": "2024-11-01T09:27:52.676Z",
"path": "/v1/events/trigger",
"message": "Trigger is missing: actor object",
"error": "Bad Request"
}
{
"statusCode": 400,
"timestamp": "2024-11-01T09:27:52.676Z",
"path": "/v1/events/trigger",
"message": "Trigger is missing: actor object",
"error": "Bad Request"
}
Novu
What is Novu - Novu
Novu is a full-stack (UI Components, API, and Framework) open source notification infrastructure platform for building, managing, delivering, and monitoring all types of end-user notifications.
9 Replies
Dima Grossman
Dima Grossmanβ€’3w ago
Hi @Willem, I think I see something that might be related. Could it be that your payload includes a key named: actor ?
Willem
WillemOPβ€’3w ago
Hey @Dima Grossman, here's the payload I'm providing:
"payload": {
"type": "---",
"actionUrl": "--",
"ID": "--",
"title": "---h",
"companyName": "---",
"appBaseUrl": "---"
}
"payload": {
"type": "---",
"actionUrl": "--",
"ID": "--",
"title": "---h",
"companyName": "---",
"appBaseUrl": "---"
}
It does not contain a key "actor". @Dima Grossman, never mind, I found the issue. In the workflow I defined a particular notification that was expecting actor to be defined. This caused the trigger to respond with a 404400
Dima Grossman
Dima Grossmanβ€’3w ago
Oh I see Glad you resolved it!
Willem
WillemOPβ€’3w ago
Is there some cache mechanism in place for workflows updated in the UI? When I'm hitting the triggers endpoint, it's still giving me back the 400 response. In the UI everything looking good now πŸ‘
Dima Grossman
Dima Grossmanβ€’3w ago
Might be, altho cache should be revoked after updating something there Are you updating the correct environment?
Willem
WillemOPβ€’3w ago
I double checked and I'm updating and triggering the event from the right environment. I created a minimal reproducible workflow where I have an in-app notification that contains the following copy:
{{#if actor}}{{actor.avatar}}{{/if}}
{{#if actor}}{{actor.avatar}}{{/if}}
When I call this new trigger with the following payload:
{
"name": "test-actor",
"to": [
],
"payload": {}
}
{
"name": "test-actor",
"to": [
],
"payload": {}
}
I still get a 400 bad request error indicating that actor should be required. When I update the in app notification to just contain "hello", the trigger succeeds with the payload without actor defined.
Novu_Bot
Novu_Botβ€’3w ago
@Willem, you just advanced to level 1!
Willem
WillemOPβ€’2w ago
@Dima Grossman is there any formal way of addressing this problem? It seems that checking for the truthiness of an actor property in the content of a notification is interpreted by the request validation as the actor to be required πŸ˜₯
Dima Grossman
Dima Grossmanβ€’2w ago
Ohhh now I see, i'm not sure if we will be able to extract those conditionals situations. But i'm wondering if we should throw an error on missing subscriber regardless. Do you mind submitting a GitHub issue on the matter so we can discuss it there with the broader team and ocmmunity?
Want results from more Discord servers?
Add your server