-
Notifications
You must be signed in to change notification settings - Fork 220
fix(async-nats): add empty subject check #1402
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
base: main
Are you sure you want to change the base?
Conversation
|
Hey. Thanks for the PR. However, can you elaborate or show example how empty subject was affecting request/response patterns and routing? |
Jarema
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be validated on Core Nats level, with new error kind.
thank you for reply. I think this also need validated on async-nat, because empty subject name will never be valid, add a check to quickly return when the subject name is empty, avoiding unnecessary requests to the server. This also provides a clear error message. |
|
That's exactly what I'm asking for - add that validation for |
|
@Jarema It appears that jetstream.send_publish does not call client.publish. |
|
@hysyeah jetstream |
|
@Jarema I think it would be best if you handle this implementation, starting |

Background
The
send_publishfunction previously did not validate for empty subject strings.This oversight allowed empty subjects to be processed, which caused nats-server to incorrectly route request payloads to the respond box, then resulting in JSON deserialization failures.
like that:
Error: Error { kind: Other, source: Some(Error("data did not match any variant of untagged enum Response", line: 0, column: 0)) }what this pr do
This PR adds a validation check for empty subjects in the
send_publish, immediately returning an error when a subject is empty.