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

UnableToFindDownstreamRouteError, Failed to match Route configuration for upstream path: /, verb: GET #1973

Closed
pseudorasbora opened this issue Feb 25, 2024 · 8 comments
Labels
Consul Service discovery by Consul QoS Ocelot feature: Quality of Service Service Discovery Ocelot feature: Service Discovery

Comments

@pseudorasbora
Copy link

hi:

upgrade from 22.0.1 to 23.0.0:

it throws error "bad gateway, 502" when using method "get". methods "put/post/delete" work well.

ocelot log:
requestId: 0HM5DM6ULMR8I:00000002, previousRequestId: no previous request id, message: Error Code: UnableToFindDownstreamRouteError Message: Failed to match Route configuration for upstream path: /api/xxx, verb: GET. errors found in ResponderMiddleware. Setting error response for request path:/api/xxx, request method: GET

now it works after rollback to 22.0.1.

thanks!

@raman-m
Copy link
Member

raman-m commented Feb 25, 2024

Hi

Could you attach ocelot.json file and C# app startup code (configuring services etc.) please?
Also full exception call stack is desired.

But it is better to upload full app code for review.

So, please provide more information!

@raman-m
Copy link
Member

raman-m commented Feb 26, 2024

@pseudorasbora
Is it so difficult to attach more details here?
We cannot decide having so short description!

@raman-m
Copy link
Member

raman-m commented Feb 26, 2024

@AlyHKafoury Are you online?

@pseudorasbora
Copy link
Author

pseudorasbora commented Mar 1, 2024

sorry, it's online.

ocelot.json

{
  "Routes": [

    {
      "DownstreamPathTemplate": "/{url}",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/msgapi/{url}",
      "UpstreamHttpMethod": [ "Get", "Post", "Put", "Delete" ],
      "ServiceName": "MsgApi",
      "LoadBalancerOptions": {
        "Type": "NoLoadBalancer"
      },

      "RateLimitOptions": {
        "EnableRateLimiting": true,
        "Period": "1s", 
        "PeriodTimespan": 3, 
        "Limit": 5
      },

      "QoSOptions": {
        "ExceptionsAllowedBeforeBreaking": 3, 
        "DurationOfBreak": 60000, 
        "TimeoutValue": 120000 
      },

      "AuthenticationOptions": {
        "AuthenticationProviderKey": "gatewayBearer",
        "AllowedScopes": []
      },

      "DangerousAcceptAnyServerCertificateValidator": true
    }

  ],
  "GlobalConfiguration": {
    "BaseUrl": "https://gtw.dev.com",

    //consul
    "ServiceDiscoveryProvider": {
      "Scheme": "http",
      "Host": "localhost",
      "Port": 3123,
      "Type": "Consul", 
      "Token": "xxxxxxxxxxxxxxxxxxxxx", 
      "ConfigurationKey": "ocelot" 
    },

    "RateLimitOptions": {
      "DisableRateLimitHeaders": false,
      "QuotaExceededMessage": "xxxx",
      "HttpStatusCode": 222,
      "ClientIdHeader": "client-id" 
    }

  }
}

startup code

            services
                .AddOcelot(new ConfigurationBuilder()
                    .AddJsonFile("ocelot.json", optional: false, reloadOnChange: true)
                    .Build())
                .AddPolly()   
                .AddConsul();

logs

2024-02-25 13:57:36.917 +08:00 [WRN] requestId: 0HN1LOOV1BJ61:00000021, previousRequestId: No PreviousRequestId, message: '502 (Bad Gateway) status code, request uri: https://msgapi.dev.com:44322/messages/5705287553122309'
2024-02-25 13:58:02.718 +08:00 [WRN] requestId: 0HN1LOOV1BJ61:00000022, previousRequestId: No PreviousRequestId, message: 'DownstreamRouteFinderMiddleware setting pipeline errors. IDownstreamRouteFinder returned Error Code: UnableToFindDownstreamRouteError Message: Failed to match Route configuration for upstream path: /, verb: GET.'
2024-02-25 13:58:02.719 +08:00 [WRN] requestId: 0HN1LOOV1BJ61:00000022, previousRequestId: No PreviousRequestId, message: 'Error Code: UnableToFindDownstreamRouteError Message: Failed to match Route configuration for upstream path: /, verb: GET. errors found in ResponderMiddleware. Setting error response for request path:/, request method: GET'
2024-02-25 13:58:07.979 +08:00 [WRN] requestId: 0HN1LOOV1BJ61:00000025, previousRequestId: No PreviousRequestId, message: '502 (Bad Gateway) status code, request uri: https://msgapi.dev.com:44322/messages/5705287553122309'
2024-02-25 14:04:51.023 +08:00 [WRN] requestId: 0HN1LOUM7UL5G:00000001, previousRequestId: No PreviousRequestId, message: 'You have ignored all SSL warnings by using DangerousAcceptAnyServerCertificateValidator for this DownstreamRoute, UpstreamPathTemplate: Ocelot.Values.UpstreamPathTemplate, DownstreamPathTemplate: /{url}'

2024-02-25 14:07:06.661 +08:00 [WRN] requestId: 0HN1LOUM7UL5H:00000002, previousRequestId: No PreviousRequestId, message: '502 (Bad Gateway) status code, request uri: https://msgapi.dev.com:44322/agents/10001'
2024-02-25 14:07:19.338 +08:00 [WRN] requestId: 0HN1LOUM7UL5G:00000012, previousRequestId: No PreviousRequestId, message: 'Error Code: RequestTimedOutError Message: Timeout making http request, exception: Polly.CircuitBreaker.BrokenCircuitException`1[System.Net.Http.HttpResponseMessage]: The circuit is now open and is not allowing calls.
   at Polly.CircuitBreaker.CircuitStateController`1.OnActionPreExecute()
   at Polly.CircuitBreaker.AsyncCircuitBreakerEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, ExceptionPredicates shouldHandleExceptionPredicates, ResultPredicates`1 shouldHandleResultPredicates, ICircuitController`1 breakerController)
   at Polly.AsyncPolicy`1.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy`1.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Ocelot.Provider.Polly.PollyPoliciesDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Ocelot.Requester.TimeoutDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpMessageInvoker.<SendAsync>g__SendAsyncWithTelemetry|6_0(HttpMessageHandler handler, HttpRequestMessage request, CancellationToken cancellationToken)
   at Ocelot.Requester.MessageInvokerHttpRequester.GetResponse(HttpContext httpContext) errors found in ResponderMiddleware. Setting error response for request path:/agents/10001, request method: GET'

@raman-m
Copy link
Member

raman-m commented Mar 1, 2024

@ggnaegi Please consult this developer! 🙏 I expect misconfiguration issue...
I'm a bit tired of such inquiries...

@raman-m raman-m added Service Discovery Ocelot feature: Service Discovery QoS Ocelot feature: Quality of Service Consul Service discovery by Consul labels Mar 1, 2024
@ggnaegi
Copy link
Member

ggnaegi commented Mar 1, 2024

hi:

upgrade from 22.0.1 to 23.0.0:

it throws error "bad gateway, 502" when using method "get". methods "put/post/delete" work well.

ocelot log:
requestId: 0HM5DM6ULMR8I:00000002, previousRequestId: no previous request id, message: Error Code: UnableToFindDownstreamRouteError Message: Failed to match Route configuration for upstream path: /api/xxx, verb: GET. errors found in ResponderMiddleware. Setting error response for request path:/api/xxx, request method: GET

now it works after rollback to 22.0.1.

thanks!

Hello @pseudorasbora a lot of new features and changes were introduced in the release 23. We are going to release 23.1 next week. Could you try the new release first (a bug with the request content has been addressed)? If the issue persist, we will try to find a solution with you.

⚠️ Could you maybe change Ocelot log level and provide us more verbose logs?

Thanks!

@pseudorasbora
Copy link
Author

release 23.1

hi,
it worked well after upgrading to release 23.1 .
thanks for ur help!

@pseudorasbora
Copy link
Author

@ggnaegi Please consult this developer! 🙏 I expect misconfiguration issue... I'm a bit tired of such inquiries...

thanks for ur help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Consul Service discovery by Consul QoS Ocelot feature: Quality of Service Service Discovery Ocelot feature: Service Discovery
Projects
None yet
Development

No branches or pull requests

3 participants