nacos-sdk-go icon indicating copy to clipboard operation
nacos-sdk-go copied to clipboard

gRPC over https not working

Open YanshuoH opened this issue 1 year ago • 0 comments

What version of nacos-sdk-go are you using?

v2.1.0

What version of nacos-sever are you using?

v2.1.1

What version of Go are you using (go version)?

$ go version
go version go1.17 darwin/amd64

What operating system (Linux, Windows, …) and version?

MacOS Monterey

What did you do?

Try to connect to nacos server via https, log shows error as such:

2022-10-26T10:50:04.009+0800	WARN	rpc/rpc_client.go:226	[RpcClient.Start] config-0-d4ff3681-35f1-46c1-8126-f8a4ae9804a4 fail to connect to server on start up, error message=rpc error: code = DeadlineExceeded desc = context deadline exceeded, start up retry times left=1

The config is:

	sc := []constant.ServerConfig{
		{
			Scheme: "https",
			IpAddr: "hide-for-security.com",
			Port:        443,
			ContextPath: constant.DEFAULT_CONTEXT_PATH,
		},
	}
	cc := constant.ClientConfig{
		TimeoutMs:           10000,
		Username:            "nacos",
		Password:            "hide-for-security",
		NamespaceId:         "test",
		NotLoadCacheAtStart: true,
		LogDir:              defaultNacosLogDir,
		CacheDir:            defaultNacosCacheDir,
		LogLevel:            defaultNacosLogLevel,
		AppendToStdout:      true,
	}

By default nacos will compute a rpc port with the given port (443) + 1000, which results to 1443 for the grpc connection.

What did you expect to see?

Use the given port 443 for grpc connection with proper dial credentials set. May relates to the unanswered yet closed issue: https://github.com/nacos-group/nacos-sdk-go/issues/470

Or, give user options to set both http/grpc port.

YanshuoH avatar Oct 26 '22 02:10 YanshuoH