https://pulumi.com logo
Title
p

prehistoric-kite-30979

05/27/2021, 1:45 PM
Hi, I'm trying to write my own provider using the boilerplate template but I think there is a breaking bug. From what I can tell the provider is expected to output to stdout the port it is listening on, but what appears to happen is that grpc logging beats it to it.
pulumi:providers:tsb (tsb):
    error: tsb (resource) plugin [/Users/liamwhite/go/bin/pulumi-resource-tsb] wrote a non-numeric port to stdout ('2021-05-27T13:44:04.073942Z	info	[core]parsed scheme: ""'): strconv.Atoi: parsing "2021-05-27T13:44:04.073942Z\tinfo\t[core]parsed scheme: \"\"": invalid syntax
A bit more research and it seems grpc clients log info to stdout by default...
Ok, so if I redirect all logs to stderr, it works 🙂
// NewHostClient dials the target address, connects over gRPC, and returns a client interface.
func NewHostClient(addr string) (*HostClient, error) {
	grpclog.SetLoggerV2(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr))
	conn, err := grpc.Dial(
		addr,
		grpc.WithInsecure(),
		grpc.WithUnaryInterceptor(rpcutil.OpenTracingClientInterceptor()),
		rpcutil.GrpcChannelOptions(),
	)
Does the Pulumi team want me to PR this fix or would you like to discuss it further?
If I send to stderr they always show up in diagnostics so maybe discard info level logs?
b

billowy-army-68599

05/27/2021, 3:48 PM
opening an issue on this would be great, i dont think we've seen this manifest itself in our providers yet
p

prehistoric-kite-30979

05/27/2021, 4:12 PM