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

Metadata API produces invalid subscription rule match value when it's nil #7049

Closed
antontroshin opened this issue Oct 17, 2023 · 3 comments · Fixed by #7067
Closed

Metadata API produces invalid subscription rule match value when it's nil #7049

antontroshin opened this issue Oct 17, 2023 · 3 comments · Fixed by #7067
Assignees
Labels
good first issue Good for newcomers kind/bug Something isn't working P1
Milestone

Comments

@antontroshin
Copy link
Contributor

In what area(s)?

/area runtime

/area operator

/area placement

/area docs

/area test-and-release

What version of Dapr?

1.1.x
1.0.x
edge: output of git describe --dirty

Expected Behavior

Rule match value to be empty or nil (not returned in the response)

Actual Behavior

Prints an invalid match value string which is produced by Go's fmt.Sprintf function.

 "subscriptions": [
    {
      "pubsubname": "orderpubsub",
      "topic": "orders",
      "rules": [
        {
          "match": "%!s(<nil>)", // <--- The value is a product of `fmt.Sprintf("%s", nil)`

Steps to Reproduce the Problem

  1. Clone quickstart git clone https://github.com/dapr/quickstarts.git
  2. go to pub sub quickstart cd pub_sub/go/sdk/order-processor
  3. run app dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 --components-path ../../../components -- go run app.go
  4. Observe the log app is subscribed to the following topics: [orders] through pubsub=orderpubsub
  5. Run curl http://localhost:3501/v1.0/metadata | jq
  6. The response will show the programmatic subscription orderpubsub with rule's match field as "%!s(<nil>)"
➜  curl http://localhost:3501/v1.0/metadata |jq
{
  "id": "order-processor",
  "runtimeVersion": "1.12.0",
  "components": [
   ...
  ],
  ...
  "subscriptions": [
    {
      "pubsubname": "orderpubsub",
      "topic": "orders",
      "rules": [
        {
          "match": "%!s(<nil>)", // <--- The value is a product of `fmt.Sprintf("%s", nil)`
          "path": "/orders"
        }
      ],
      "deadLetterTopic": ""
    }
  ],
...
}

Release Note

RELEASE NOTE: FIX Metadata API programmatic subscription rule's match field, marshal invalid nil value format

@antontroshin antontroshin added the kind/bug Something isn't working label Oct 17, 2023
@mukundansundar mukundansundar added this to the v1.13 milestone Oct 17, 2023
@mukundansundar mukundansundar added P1 good first issue Good for newcomers labels Oct 17, 2023
@Taction
Copy link
Member

Taction commented Oct 18, 2023

/assign

@antontroshin
Copy link
Contributor Author

Note: the place where this happens is here

Match: fmt.Sprintf("%s", r.Match),

@Taction
Copy link
Member

Taction commented Oct 20, 2023

@antontroshin Thanks for reporting this issue and pointing out the code where it happens!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/bug Something isn't working P1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants