Dapr: Component Contrib middleware not registered with dapr runtime

Created on 7 Apr 2020  路  7Comments  路  Source: dapr/dapr

/area runtime

/area operator
/area placement
/area docs
/area test-and-release

What version of Dapr?


v0.6.0-5-gbff71a5a

Expected Behavior

Middleware from component-contrib is available to use as a component in the dapr runtime. including:

Actual Behavior

It looks like the component contrib middleware is not being registered with the dapr runtime. Unless I've missed something the only middleware being registered with the runtime is the default uppercase and oauth2. This is leading people to try using other middleware receiving the following error:

level=warning msg="failed to build HTTP pipeline: couldn't find HTTP middleware middleware.http.ratelimit"

Steps to Reproduce the Problem

Deploy a middleware component

 apiVersion: dapr.io/v1alpha1
 kind: Component
 metadata:
   name: ratelimit
 spec:
   type: middleware.http.ratelimit
   metadata:
   - name: maxRequestsPerSecond
     value: "10"

Deploy a middleware config

apiVersion: dapr.io/v1alpha1
 kind: Configuration
 metadata:
   name: pipeline
 spec:
   httpPipeline:
     handlers:
     - name: ratelimit
       type: middleware.http.ratelimit

Launch dapr and watch the logs for an error.

cc: @benc-uk @cmendible

kinbug

Most helpful comment

I'll post a fix ASAP

All 7 comments

I think the maxRequestsPerSecond value needs to be in double quotes otherwise the component won't load

Updated the example, thanks @benc-uk.

Copying from Gitter:

There's 2 subtly different errors, couldn't find middleware middleware.http.bearer of type middleware.http.bearer which is when the middleware in the config doesn't match the component (or the component is invalid). The other error is couldn't find http middleware middleware.http.bearer which is when the middleware registry doesn't have a middleware with a matching name registered. Probably worth changing these to be more distinct too

Yep... seems that there are no calls to add other middleware than oauth2 and uppercase:

https://github.com/dapr/dapr/blob/bff71a5ab2e8fe0d83f2914796b8ed4b5d5db806/cmd/daprd/main.go#L308

/cc @youngbupark @Haishi2016 @msfussell @orizohar

If this is the case, we need to update daprd and issue a 0.6.1 release.

A PR for this would be most welcome.

I'll post a fix ASAP

Was this page helpful?
0 / 5 - 0 ratings