Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Triggering an Event might lead to an outdated Error Messages (when using outdated request) #4891

Closed
2 tasks done
JonasDoe opened this issue Nov 23, 2023 · 3 comments
Labels

Comments

@JonasDoe
Copy link

JonasDoe commented Nov 23, 2023

📜 Description

When triggering an Event with an outdated request structure, I get an error suggesting the outdates request structure is still expected. Here's a sketch:

{
    "name": "{{workflow}}",
    "to": [{
        "type": "Topic",
        "topicKey": "{{topicKey}}"    
    }],
    "payload": {
      "customVariables": "Hello World",
      "from": "Trigger event"
    },
    "transactionId": "{{triggerEventTransactionId}}",
    "actor": {
        "subscriberId:": "{{subscriberIdTest}}",
    }
  }

The actor is invalid, according to the documentation it should be a string, not an object. The error response still suggests otherwise, though:

{
    "message": [
        "actor.subscriberId should not be null or undefined",
        "actor.subscriberId must be a string"
    ],
    "error": "Bad Request",
    "statusCode": 400
}

👟 Reproduction steps

Just run a POST request against /events/trigger which is valid except for the actor.

👍 Expected behavior

I'ld expect an error response like

{
    "message": [
        "actor must be a string"
    ],
    "error": "Bad Request",
    "statusCode": 400
}

👎 Actual Behavior with Screenshots

image

Novu version

NOVU self-hosted v0.21.0

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?

Are you willing to submit PR?

None

@jainpawan21
Copy link
Member

Hi @JonasDoe
I see you are using postman variables as value in actor.subscriberId. Could you double check if jwt_test is a valid string or not. You can check postman console of request and response.

@JonasDoe
Copy link
Author

JonasDoe commented Dec 5, 2023

Hey, I found out my request was actually faulty - the core issue was that I used "subscriberId:" instead of "subscriberId". Now, it's actually working. Sry for the fuzz!
What I don't get is why the documentation claims it must be a string. Are both approaches supported, and one of them is a deprecated variant?

@JonasDoe
Copy link
Author

JonasDoe commented Dec 7, 2023

Well, either I was blind before, or it was fixed later. But I see that the documenation now reflects both cases - subscriberId being a string or an object (now?). :)

@JonasDoe JonasDoe closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants