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

micro commands give parser errors on names #738

Closed
geiseri opened this issue Mar 22, 2024 · 1 comment · Fixed by #741
Closed

micro commands give parser errors on names #738

geiseri opened this issue Mar 22, 2024 · 1 comment · Fixed by #741
Assignees
Labels
defect Suspected defect such as a bug or regression

Comments

@geiseri
Copy link

geiseri commented Mar 22, 2024

Observed behavior

I am not 100% sure if this is a nats-c bug or nats-cli bug. I have a microservice published via the nats-c api. When I run nats micro list I see the following error.

$ nats micro list
nats: error: /endpoints/0/name: does not match pattern '^[a-zA-Z0-9_-]+$',/endpoints/1/name: does not match pattern '^[a-zA-Z0-9_-]+$',/endpoints/2/name: does not match pattern '^[a-zA-Z0-9_-]+$'

If I run nats req '$SRV.INFO.candleserver' I see the following output:

~/nats$ nats req '$SRV.INFO.candleserver' ''
13:37:38 Sending request on "$SRV.INFO.candleserver"
13:37:38 Received with rtt 8.610413ms
{"description":"Candlestick Server","endpoints":[{"name":"candles.put_candles","subject":"candles.put_candles"},{"name":"candles.get_candles","subject":"candles.get_candles"},{"name":"candles.valid_timerange","subject":"candles.valid_timerange"}],"id":"UZEQXJ2PMIOH1W9WG4M9QV","name":"candleserver","type":"io.nats.micro.v1.info_response","version":"1.0.0"}

If I look at the demo service reported by nats cli I see the following:

~/nats$ nats req '$SRV.INFO.foobar' ''
13:39:30 Sending request on "$SRV.INFO.foobar"
13:39:30 Received with rtt 1.162433ms
{"name":"foobar","id":"ZjT4ZocsAU0ubxDd3HER4X","version":"1.0.0","metadata":{"_nats.client.created.library":"natscli","_nats.client.created.version":"0.1.4"},"type":"io.nats.micro.v1.info_response","description":"NATS CLI Demo Service (foobar)","endpoints":[{"name":"echo","subject":"foobar.echo","queue_group":"q","metadata":null}]}

I noticed something different in the name returned. In the case of nats-c the name is a combination of the endpoint is servicename.endpointname but the demo server uses just name. It would make sense since the . is not covered by the regexp.

Expected behavior

The service is displayed in the UI along side the service displayed with nats micro serve foobar

Server and client version

Server: v2.10.7
nats-c: 3.7.0

Host environment

No response

Steps to reproduce

Start the demo service

NATS CLI Micro Service foobar handler 993027 waiting for requests on nats://127.0.0.1:4222

Listening Subjects:

  foobar.echo: Echo Service

Requests Log:

Run nats micro list

~/nats$ nats micro list
╭────────────────────────────────────────────────────────────────────────────╮
│                             All Micro Services                             │
├────────┬─────────┬────────────────────────┬────────────────────────────────┤
│ Name   │ Version │ ID                     │ Description                    │
├────────┼─────────┼────────────────────────┼────────────────────────────────┤
│ foobar │ 1.0.0   │ ZjT4ZocsAU0ubxDd3HER4X │ NATS CLI Demo Service (foobar) │
╰────────┴─────────┴────────────────────────┴────────────────────────────────╯

Run nats-c created service

~/nats$ nats micro list
nats: error: /endpoints/0/name: does not match pattern '^[a-zA-Z0-9_-]+$',/endpoints/1/name: does not match pattern '^[a-zA-Z0-9_-]+$',/endpoints/2/name: does not match pattern '^[a-zA-Z0-9_-]+$'
@geiseri geiseri added the defect Suspected defect such as a bug or regression label Mar 22, 2024
@ripienaar
Copy link

Maybe one for the C client instead.

We can see from https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-32.md#design that those are not valid names.

@ripienaar ripienaar transferred this issue from nats-io/natscli Mar 24, 2024
@levb levb self-assigned this Mar 27, 2024
@levb levb closed this as completed in #741 Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants