zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.08k stars 3.93k forks source link

I followed the documentation but found that the configuration cannot be parsed? #3854

Open onsenOnly opened 9 months ago

onsenOnly commented 9 months ago

https://go-zero.dev/docs/tutorials/gateway/grpc?_highlight=grpc#routemapping

I followed the instructions above in the documentation. But in the end it was discovered that ProtoSets and Mappings did not map the above values.

image

kesonan commented 9 months ago

Have you created the gateway.yaml configuration file under etc?

onsenOnly commented 9 months ago

是的。按照文档操作的,看到Target的值是有了,但ProtoSets和Mappings值均为nil,导致请求的时候得到的结果是404。 etc/gateway.yaml

Name: demo1-gateway
Host: localhost
Port: 8888
Upstreams:
  - Grpc:
      Target: 0.0.0.0:8080
      # protoset mode
      ProtoSets:
        - hello.pb
      # Mappings can also be written in proto options
      Mappings:
        - Method: get
          Path: /ping
          RpcPath: hello.Hello/Ping

image image

gateway.yaml在etc下创建了配置文件吗?

Issues-translate-bot commented 9 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Yes. According to the documentation, you can see that the Target value is there, but the ProtoSets and Mappings values ​​are both nil, resulting in a 404 result when requesting. etc/gateway.yaml

Name: demo1-gateway
Host: localhost
Port: 8888
Upstreams:
- Grpc:
Target: 0.0.0.0:8080
# protoset mode
ProtoSets:
- hello.pb
# Mappings can also be written in proto options
Mappings:
- Method: get
Path: /ping
RpcPath: hello.Hello/Ping

![image](https://private-user-images.githubusercontent.com/26090883/297248873-2501079c-5550-4dc1-8243-7372230e84eb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..jjn2vI lv8L89IcQDnPkSgw0lPLdI0a-YwAUr3isqBc4) ![image]( https://private-user-images.githubusercontent.com/26090883/297249021-e453c708-e477-4a99-9e0e-33e196e0ba94.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..N1JFhCNYIASrvph2 Mar1tC5P7T8u4v2f--myH6sIQHA)

Have you created the configuration file gateway.yaml under etc?

ProtoSets and Mappings should be at the same level as Grpc

image
Kseng commented 9 months ago

是的。按照文档操作的,看到Target的值是有了,但ProtoSets和Mappings值均为nil,导致请求的时候得到的结果是404。 etc/gateway.yaml

Name: demo1-gateway
Host: localhost
Port: 8888
Upstreams:
  - Grpc:
      Target: 0.0.0.0:8080
      # protoset mode
      ProtoSets:
        - hello.pb
      # Mappings can also be written in proto options
      Mappings:
        - Method: get
          Path: /ping
          RpcPath: hello.Hello/Ping

image image

gateway.yaml在etc下创建了配置文件吗?

ProtoSets 和 Mappings 应该是跟Grpc 同一个层级

image
Issues-translate-bot commented 9 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Yes. According to the documentation, you can see that the Target value is there, but the ProtoSets and Mappings values ​​are both nil, resulting in a 404 result when requesting. etc/gateway.yaml

Name: demo1-gateway
Host: localhost
Port: 8888
Upstreams:
- Grpc:
Target: 0.0.0.0:8080
# protoset mode
ProtoSets:
- hello.pb
# Mappings can also be written in proto options
Mappings:
- Method: get
Path: /ping
RpcPath: hello.Hello/Ping

![image](https://private-user-images.githubusercontent.com/26090883/297248873-2501079c-5550-4dc1-8243-7372230e84eb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..pw_dLz t7tRftIXSTDp-LSQ5p_BeFCrU-W6cJqzuOAxI) ![image ) SYJKElCadaVTlJ5YQ3BMCV1JHSI)

Have you created the configuration file gateway.yaml under etc?

ProtoSets and Mappings should be at the same level as Grpc

image