cli
cli copied to clipboard
Default Dapr gRPC port is inconsistent with documentation
According to the dapr run
documentation, the default value for --dapr-grpc-port
is 50001
.
Expected Behavior
When invoking dapr run
without specifying --dapr-grpc-port
would cause it to listen on port 50001 for gRPC.
If using a random port is the prefered behavior, then I'd expect the documentation to say that the default port number is random and specify the expected port range.
Actual Behavior
The actual behavior for dapr run
seems to be to select a random gRPC port, which is different from what the documentation states.
NOTE: I did observe the .NET SDK assumes a default port of 50001. Not sure about other SDKs, but this does seem to indicate some sort of mismatched expectations between SDKs and the Dapr CLI.
Steps to Reproduce the Problem
Using Dapr CLI v1.7, run a command similar to the following:
dapr run --app-id myapp --app-protocol http --dapr-http-port 3501 --app-port 5001
And observe the first line of output (it mentions gRPC port 53375):
Starting Dapr with id myapp. HTTP Port: 3501. gRPC Port: 53375
This was a problem for me because I run the Dapr CLI separately from my application code. This means my application code doesn't get a DAPR_GRPC_PORT
specified and I have to know in advance what port Dapr is listening on. Since SDKs assume a default port (50001), it made logical sense to me that the Dapr CLI would default to the same port as the SDKs.
Release Note
RELEASE NOTE: FIX Bug in runtime (or documentation).
Verified the same behavior with CLI 1.8 as well. The doc also says default http port to be 3500, but that's random as well
IMO what dapr
CLI should do is try to default to 3500 for HTTP or 50001 for gRPC via dapr run
command, similar to daprd
. But in the case of dapr
CLI, it should check if the ports are available and then use that for the run, and if it is not available then a random port needs to be used which is the existing functionality.
Docs also need to be updated to reflect this behaviour of the dapr
CLI
/assign