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

网关限流添加api分组后无法找到服务 #3017

Open
q876625596 opened this issue Jan 7, 2023 · 3 comments
Open

网关限流添加api分组后无法找到服务 #3017

q876625596 opened this issue Jan 7, 2023 · 3 comments
Labels
area/gateway-flow-control Issues or PRs related to API gateway flow control kind/question Category issues related to questions or problems

Comments

@q876625596
Copy link

q876625596 commented Jan 7, 2023

Issue Description

Type: bug report

Describe what happened (or what feature you want)

当我没有在网关添加api分组的时候,一切正常,
当我在网关中添加了api分组,启动网关之后,控制台无法看到网关服务。
When I did not add an API group to the gateway, everything was normal,
When I add an api group to the gateway and start the gateway, the dashboard cannot see the gateway service.

这是我在GatewayConfig中添加的api分组
This is the api group I added in GatewayConfig

    @PostConstruct
    public void doInit() {
        initCustomizedApis();
    }

    private void initCustomizedApis() {
        Set<ApiDefinition> definitions = new HashSet<>();
        ApiDefinition api1 = new ApiDefinition("custom_system")
                .setPredicateItems(new HashSet<ApiPredicateItem>() {{
                    add(new ApiPathPredicateItem().setPattern("/system/sysUser/list"));
                    add(new ApiPathPredicateItem().setPattern("/system/sysOnline/**")
                            .setMatchStrategy(SentinelGatewayConstants.URL_MATCH_STRATEGY_PREFIX));
                }});
        definitions.add(api1);
        GatewayApiDefinitionManager.loadApiDefinitions(definitions);
    }

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

  1. sentinel version 1.8.5
  2. spring cloud alibaba version 2021.0.4.0
  3. fastjson version 2.0.10
  4. jdk version 1.8
  5. 其他配置和文档一致(Other configurations are consistent with the documents)

Tell us your environment

Windows11

Anything else we need to know?

@sczyh30 sczyh30 added kind/question Category issues related to questions or problems area/gateway-flow-control Issues or PRs related to API gateway flow control labels Jan 11, 2023
@sczyh30
Copy link
Member

sczyh30 commented Jan 11, 2023

确认网关有触发正常访问,相关排查可参考 FAQ.

@ginwAa
Copy link

ginwAa commented Sep 5, 2023

遇到同样的问题,请问最后是怎么解决的

@shuaiho
Copy link

shuaiho commented Oct 27, 2023

同样的问题,调用 GatewayApiDefinitionManager.loadApiDefinitions(definitions);后就失效。
且在http://ip:port/actuator/sentinel中,查不到信息。
不调用时,actuator中显示如下:
image

调用后显示显示如下:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway-flow-control Issues or PRs related to API gateway flow control kind/question Category issues related to questions or problems
Projects
None yet
Development

No branches or pull requests

4 participants