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

HTTP API request to /api/nodes/{node_name} where {node_name} isn't a valid RabbitMQ node fails with 500 error. #10330

Closed
kjnilsson opened this issue Jan 12, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@kjnilsson
Copy link
Contributor

kjnilsson commented Jan 12, 2024

Describe the bug

HTTP API request to /api/nodes/{node_name} where {node_name} isn't a valid RabbitMQ node fails with 500 error.

A 404 would be a more appropriate response.

Reproduction steps

  1. curl -v http://localhost:15672/api/nodes/NOTANODENAME'
  2. observe 500 response code

...

Expected behavior

404 would be the expected response when a resource does not exist.

Additional context

find_type(Node, [{Type, Nodes} | Rest]) ->
case lists:member(Node, Nodes) of
true -> Type;
false -> find_type(Node, Rest)
end.

This function does not handle unknown node names correction, however the intire resouce_exist callback impl could be substantially optimised by just checking the the node is in rabbit_nodes:list_members/0

@kjnilsson kjnilsson added the bug label Jan 12, 2024
@ikavgo ikavgo self-assigned this Jan 23, 2024
michaelklishin added a commit that referenced this issue Jan 26, 2024
mergify bot pushed a commit that referenced this issue Jan 26, 2024
Per discussion in #10415, this introduces a new module,
rabbit_mgmt_nodes, which provides a couple of helpers
that can be used to implement Cowboy REST's
resource_exists/2 in the modules that return
information about cluster members.

(cherry picked from commit 0c0e2ca)
michaelklishin added a commit that referenced this issue Jan 26, 2024
@michaelklishin michaelklishin added this to the 3.12.13 milestone Jan 26, 2024
michaelklishin added a commit that referenced this issue Jan 31, 2024
Per discussion in #10415, this introduces a new module,
rabbit_mgmt_nodes, which provides a couple of helpers
that can be used to implement Cowboy REST's
resource_exists/2 in the modules that return
information about cluster members.
michaelklishin added a commit that referenced this issue Feb 1, 2024
Per discussion in #10415, this introduces a new module,
rabbit_mgmt_nodes, which provides a couple of helpers
that can be used to implement Cowboy REST's
resource_exists/2 in the modules that return
information about cluster members.
michaelklishin added a commit that referenced this issue Feb 29, 2024
Per discussion in #10415, this introduces a new module,
rabbit_mgmt_nodes, which provides a couple of helpers
that can be used to implement Cowboy REST's
resource_exists/2 in the modules that return
information about cluster members.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants