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

1 messages · Page 1 of 1 (latest)

mighty maple
#

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": {}

Full response:

{
    "statusCode": 400,
    "timestamp": "2024-11-01T09:27:52.676Z",
    "path": "/v1/events/trigger",
    "message": "Trigger is missing: actor object",
    "error": "Bad Request"
}
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.

hazy hull
#

Hi @mighty maple, I think I see something that might be related. Could it be that your payload includes a key named: actor ?

mighty maple
#

Hey @hazy hull, here's the payload I'm providing:

    "payload": {
        "type": "---",
        "actionUrl": "--",
        "ID": "--",
        "title": "---h",
        "companyName": "---",
        "appBaseUrl": "---"
    }

It does not contain a key "actor".

mighty maple
#

@hazy hull, 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

hazy hull
#

Oh I see

#

Glad you resolved it!

mighty maple
#

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 👍

hazy hull
#

Might be, altho cache should be revoked after updating something there

#

Are you updating the correct environment?

mighty maple
#

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

When I call this new trigger with the following 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.

whole iceBOT
#

@mighty maple, you just advanced to level 1!

mighty maple
#

@hazy hull 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 😥