Envoy: http call cluster invalid. Must be configured

Hey guys,

I’ve set up istio version 1.7.3 and I’ve added an envoy filter (see below). I see this error sometimes in the istio-proxy logs.

http call cluster invalid. Must be configured

Is there any way I can debug it to see what’s happening? It only happens sometimes.

Envoy filter

kind: EnvoyFilter
apiVersion: networking.istio.io/v1alpha3
metadata: <omitted>
spec:
  configPatches:
    - applyTo: HTTP_FILTER
      match:
        context: ANY
        listener:
          filterChain:
            filter:
              name: envoy.http_connection_manager
        proxy:
          proxyVersion: ^1\.7.*
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.http.lua
          typed_config:
            '@type': type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
            inlineCode: |
              function get_value(keyvaluepairs, key)
                for value in string.gmatch(keyvaluepairs, key .. "=([^;]*)") do
                  return value
                end
              end

              -- Called on the request path.
              function envoy_on_request(request_handle)
                local id_token = nil
                local cookies = request_handle:headers():get("cookie")
                if cookies ~= nil then
                  id_token = get_value(cookies, "auth%-token")
                end

                local headers =  {
                  [":method"] = "POST",
                  [":path"] = "/apis/v1beta1/auth",
                  [":authority"] = "core.vafilor.svc.local",
                  ["grpc-metadata-x-original-method"] = request_handle:headers():get(":method"),
                  ["grpc-metadata-x-original-authority"] = request_handle:headers():get(":authority"),
                  ["grpc-metadata-x-original-uri"] = request_handle:headers():get(":path")
                }

                if id_token ~= nil then
                  headers["authorization"] = "Bearer " .. id_token
                end

                local response_headers, response_body = request_handle:httpCall(
                    "outbound_.80_._.core.vafilor.svc.cluster.local",
                    headers,
                    "",
                    5000
                )

                if tonumber(response_headers[":status"]) ~= 200 then
                  print("Not authorized.")
                  request_handle:respond(
                    {[":status"] = response_headers[":status"]},
                    response_body
                  )
                end
              end

This is an envoy error saying that the cluster you are trying to call is not in the clusters list. you should be able to see the clusters in istioctl pc clusters