dubbo-admin icon indicating copy to clipboard operation
dubbo-admin copied to clipboard

[Bug] 403 error code when requesting nacos openapi

Open itaiit opened this issue 8 months ago • 2 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.
  • [x] I have checked the REAMDE of this repository and believe that this is not a duplicate.

Environment

  • Dubbo Admin version: develop
  • Registry center detail (type and version): nacos 2.5.0
  • Operating System version: macos 15.4.1
  • Java version: 17.0.9

Steps to reproduce this issue

Nacos is configured as our service registry with authentication credentials. The following error occurred during service initialization:

Image

Expected Result

The service started successfully with no errors.

Actual Result

The following error occurred during service initialization:

2025-04-18 16:32:51.037 ERROR 24150 --- [pool-7-thread-1] o.a.d.a.registry.nacos.NacosOpenapiUtil  :  [DUBBO] Error requesting nacos openapi, http://127.0.0.1:8848/nacos/v1/ns/service/subscribers?serviceName=demo-service&namespaceId=public&groupName=DEFAULT_GROUP, error code is 403, dubbo version: 3.2.5, current host: x.x.x.x

itaiit avatar Apr 18 '25 09:04 itaiit

你需要在 Dubbo 配置文件(例如 application.properties、application.yml、dubbo.properties 等)中正确配置 Nacos 的用户名、密码。

application.properties 示例: properties dubbo.registry.address=nacos://127.0.0.1:8848 dubbo.registry.username=nacos dubbo.registry.password=nacos

application.yml 示例: yaml dubbo: registry: address: nacos://127.0.0.1:8848 username: nacos password: nacos

更多:https://code.mayoubang.cn/conversion/share/33620015585

Image

我在方法中看到这个nacosUrl请求路径是在方法内部定义的,后续没有从配置文件中读取配置而是在url中获取拼接的,如果nacos配置了身份认证请求会出现403错误。

itaiit avatar Apr 18 '25 09:04 itaiit