Config.get not work in nameko 2.14

I try create a service for mongodb , but when I try get MONGO_URI using COnf, display method not found.


It seems that your autocomplete feature of you IDE is pointing you to another type of Config.

I’ve created a small test service with nameko 2.14.0:

from nameko.dependency_providers import Config
from nameko.web.handlers import http

class Service:

    name = "test_config"

    config = Config()

    @http("GET", "/")
    def foo(self, request):
        return f'Config Mongo url is {self.config.get("MONGODB_URI", "http://localhost:27017")}'

A config.yml


And works as expected:

$ nameko run service --config config.yml


Try to run your service, it looks good. I don’t use pyright, but it seems to interfere with nameko’s config type on autocomplete.