pulumi/pulumi · error

host is required for grpcs:// endpoint

Error message

host is required for grpcs:// endpoint

What it means

This error is returned when a grpcs:// endpoint parses with an empty Host. grpcs:// selects the TLS-enabled gRPC exporter, but the exporter still requires a host:port target to dial securely. Like the grpc case, it fails fast at endpoint parsing time.

Source

Thrown at sdk/go/common/util/otelreceiver/exporter.go:96

		if err != nil {
			return nil, err
		}
		return newFileExporter(path)

	case "grpc":
		host := u.Host
		if host == "" {
			return nil, errors.New("host is required for grpc:// endpoint")
		}
		return newGRPCExporterWithOptions(grpcExporterOptions{
			target:  host,
			headers: headersFromQuery(u.Query()),
		})

	case "grpcs":
		host := u.Host
		if host == "" {
			return nil, errors.New("host is required for grpcs:// endpoint")
		}
		return newGRPCExporterWithOptions(grpcExporterOptions{
			target:  host,
			tls:     true,
			headers: headersFromQuery(u.Query()),
		})

	case "http", "https":
		if u.Host == "" {
			return nil, fmt.Errorf("host is required for %s:// endpoint", u.Scheme)
		}
		target := url.URL{Scheme: u.Scheme, Host: u.Host, Path: u.Path}
		if target.Path == "" || target.Path == "/" {
			target.Path = "/v1/traces"
		}
		return newHTTPExporterWithOptions(httpExporterOptions{
			url:     target.String(),
			headers: headersFromQuery(u.Query()),

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Provide a host and port, e.g. grpcs://otel-collector:4317
  2. Verify the endpoint environment variable or config value was fully interpolated
  3. If TLS is not intended, use grpc:// with a valid host

Example fix

// before
endpoint := "grpcs://"
// after
endpoint := "grpcs://otel-collector:4317"
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(endpoint)
if err == nil && u.Scheme == "grpcs" && u.Host == "" {
    return fmt.Errorf("endpoint %q must include a host, e.g. grpcs://collector:4317", endpoint)
}

Try / catch

exp, err := newExporter(endpoint)
if err != nil {
    log.Fatalf("invalid OTLP endpoint %q: %v", endpoint, err)
}

Prevention

When it happens

Trigger: Passing an endpoint such as "grpcs://" or "grpcs://:4317" to the OTLP exporter factory; empty authority after grpcs:// scheme.

Common situations: Users enabling TLS by switching grpc:// to grpcs:// but dropping the host in the edit; templated URLs where the host placeholder resolved to empty.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/60c53924f398acc6. Report an issue: GitHub.