Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dapr Client Docker Compose Issue

I have 3 services that I am attempting to integrate with Dapr within my local Docker instance. Each of the services is running in an Linux container.

version: '3.4'
networks:
  NextWare:
    external: true
services:
  nextware.daprtest.service1.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - DAPR_GRPC_PORT=40001
    ports:
      - "40001:40001" # Dapr instances communicate over gRPC so we need to expose the gRPC port
      - "4001:80"
    depends_on:
      - redis
      - placement
    networks:
      - NextWare
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

  nextware.daprtest.service1.api-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
     "-app-id", "nextware.daprtest.service1.api",
     "-app-port", "3001",
     "-dapr-grpc-port", "40001",
     "-metrics-port", "9091",
     "-placement-host-address", "placement:50006", # Dapr's placement service can be reach via the docker DNS entry
     "-components-path", "/components"]

    volumes:
        - "./components/nextware.daprtest.service1.api:/components" # Mount our components folder for the runtime to use
    depends_on:
      - nextware.daprtest.service1.api
    network_mode: "service:nextware.daprtest.service1.api" # Attach the nodeapp-dapr service to the nodeapp network namespace

  nextware.daprtest.service2.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - DAPR_GRPC_PORT=40003
    ports:
      - "40003:40003" # Dapr instances communicate over gRPC so we need to expose the gRPC port
      - "4003:80"
    depends_on:
      - redis
      - placement
    networks:
      - NextWare
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

  nextware.daprtest.service2.api-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
     "-app-id", "nextware.daprtest.service2.api",
     "-app-port", "3003",
     "-dapr-grpc-port", "40003",
     "-metrics-port", "9093",
     "-placement-host-address", "placement:50006" # Dapr's placement service can be reach via the docker DNS entry
     ]
    volumes:
        - "./components/nextware.daprtest.service2.api:/components" # Mount our components folder for the runtime to use
    depends_on:
      - nextware.daprtest.service2.api
    network_mode: "service:nextware.daprtest.service2.api" # Attach the nodeapp-dapr service to the nodeapp network namespace


  nextware.daprtest.service3.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - DAPR_GRPC_PORT=40005
    ports:
      - "40005:40005" # Dapr instances communicate over gRPC so we need to expose the gRPC port
      - "4005:80"
    depends_on:
      - redis
      - placement
     
    networks:
      - NextWare
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro


  nextware.daprtest.service3.api-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
     "-app-id", "nextware.daprtest.service3.api",
     "-app-port", "3005",
     "-dapr-grpc-port", "40005",
     "-metrics-port", "9095",
     "-placement-host-address", "placement:50006" # Dapr's placement service can be reach via the docker DNS entry
     ]
    volumes:
        - "./components/nextware.daprtest.service3.api:/components" # Mount our components folder for the runtime to use
    depends_on:
      - nextware.daprtest.service3.api
    network_mode: "service:nextware.daprtest.service3.api" # Attach the nodeapp-dapr service to the nodeapp network namespace

Running Docker PS I see the following containers ..

enter image description here

After the services are up and running I attempt to invoke the following code from Service3 to Service1 ...

 var request = _mapper.Map<UpdateRequest>(integrationCommand);
 await _daprClient.InvokeMethodAsync("nextware.daprtest.service1.api", "Update", request, cancellationToken);

I am getting the following exception...

enter image description here

Is the RequestUri correct ...

"http://127.0.0.1:3500/v1.0/invoke/nextware.daprtest.service1.api/method/Update"

Given this is the DaprClient which is invoking the sidecar, I assume the above RequestUri is correct.

What am I missing?

like image 732
John Kears Avatar asked Apr 10 '26 06:04

John Kears


1 Answers

The reason for the error was due to a malformed ID and method name.

I moved to Tye from Docker compose and hit the same issue.

Then I altered the invocation as per this screen shot.

enter image description here

While this still did not call through to the Update method, it no longer returns the 500 exception.

Instead I was getting the following exception which I am just as stumped to resolve...

The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch, RemoteCertificateChainErrors

enter image description here

This was due to the following startup configuration setting which I commented out and all worked fine after that ...

enter image description here

Dapr Rocks!

like image 51
John Kears Avatar answered Apr 12 '26 19:04

John Kears



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!