{"record":{"id":"0355d386f8f3f573","repo":"grafana/k6","slug":"invalid-authority-value-v-it-needs-to-be-a-s","errorCode":null,"errorMessage":"invalid authority value: '%#v', it needs to be a string","messagePattern":"invalid authority value: '%#v', it needs to be a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/params.go","lineNumber":210,"sourceCode":"\t\t\t}\n\t\tcase \"maxSendSize\":\n\t\t\tvar ok bool\n\t\t\tresult.MaxSendSize, ok = v.(int64)\n\t\t\tif !ok {\n\t\t\t\treturn result, fmt.Errorf(\"invalid maxSendSize value: '%#v', it needs to be an integer\", v)\n\t\t\t}\n\t\t\tif result.MaxSendSize < 0 {\n\t\t\t\treturn result, fmt.Errorf(\"invalid maxSendSize value: '%#v, it needs to be a positive integer\", v)\n\t\t\t}\n\t\tcase \"tls\":\n\t\t\tif err := parseConnectTLSParam(result, v); err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\tcase \"authority\":\n\t\t\tvar ok bool\n\t\t\tresult.Authority, ok = v.(string)\n\t\t\tif !ok {\n\t\t\t\treturn result, fmt.Errorf(\"invalid authority value: '%#v', it needs to be a string\", v)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn result, fmt.Errorf(\"unknown connect param: %q\", k)\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\nfunc parseConnectTLSParam(params *connectParams, v any) error {\n\tvar ok bool\n\tparams.TLS, ok = v.(map[string]any)\n\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid tls value: '%#v', expected (optional) keys: cert, key, password, and cacerts\", v)\n\t}\n\t// optional map keys below\n\tif cert, certok := params.TLS[\"cert\"]; certok {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/grpc/params.go#L192-L228","documentation":"The authority option in client.connect() overrides the HTTP/2 :authority pseudo-header (virtual host) for the connection and must be a string (params.go:208). Numbers, booleans or objects throw 'invalid authority value ... needs to be a string'.","triggerScenarios":"connect(addr, { authority: 8080 }); { authority: true }; authority taken from untyped config such as a port or numeric ID field.","commonSituations":"Routing through proxies or load balancers that require a specific :authority; mixing up the port (belongs in the address argument) and the authority field in config.","solutions":["Pass a hostname string: authority: 'api.example.com'","Stringify non-string config values: String(host)","Keep the port in the address argument, not in authority"],"exampleFix":"// before\nclient.connect('localhost:8080', { authority: 8080 });\n\n// after\nclient.connect('localhost:8080', { authority: 'api.example.com' });","handlingStrategy":"validation","validationCode":"if (connectParams.authority !== undefined && typeof connectParams.authority !== 'string') {\n  throw new Error(`authority must be a string, got ${typeof connectParams.authority}`);\n}\nclient.connect(addr, connectParams);","typeGuard":"function isAuthority(v) {\n  return v == null || typeof v === 'string';\n}","tryCatchPattern":null,"preventionTips":["Keep the port in the address argument; authority holds a hostname","Stringify authority values coming from untyped config","Reserve authority for virtual-host routing scenarios"],"tags":["grpc","connect","authority","type-error"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}