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

PUT catalog register 500 error code on incorect ID field value #21261

Open
MaciejDromin opened this issue Jun 5, 2024 · 0 comments
Open

PUT catalog register 500 error code on incorect ID field value #21261

MaciejDromin opened this issue Jun 5, 2024 · 0 comments

Comments

@MaciejDromin
Copy link

Overview of the Issue

While trying to register new entity with PUT /catalog/register endpoint you are allowed to provide optional ID field, its value should follow uuid format and length which is validated, but incorrect HTTP code is returned


Reproduction Steps

  1. Start Consul (for example in docker)
  2. Try to register new entity with PUT /catalog/register endpoint setting incorrect ID value: "ID": "test"
  3. Notice 500 Internal Server Error code with correct exception message

image

Expected behavior

400 HTTP BAD_REQUEST should be returned

Full example payload

{
  "Datacenter": "dc1",
  "ID": "test",
  "Node": "t2.320",
  "Address": "192.168.10.10",
  "Service": {
    "ID": "redis1",
    "Service": "redis",
    "Tags": ["primary", "v1"],
    "Address": "127.0.0.1",
    "TaggedAddresses": {
      "lan": {
        "address": "127.0.0.1",
        "port": 8000
      },
      "wan": {
        "address": "198.18.0.1",
        "port": 80
      }
    },
    "Meta": {
      "redis_version": "4.0"
    },
    "Port": 8000
  },
  "Check": {
    "Node": "t2.320",
    "CheckID": "service:redis1",
    "Name": "Redis health check",
    "Notes": "Script based health check",
    "Status": "passing",
    "ServiceID": "redis1",
    "Definition": {
      "TCP": "localhost:8888",
      "Interval": "5s",
      "Timeout": "1s",
      "DeregisterCriticalServiceAfter": "30s"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant