openfaas/faas · error
log request failed
Error message
log request failed
What it means
The log streaming proxy in gateway/handlers/logs.go forwards the client's log request to the function provider's /system/logs endpoint using http.DefaultTransport.RoundTrip. If that round trip fails at the transport level — connection refused, DNS failure, TLS error, timeout — the gateway logs 'LogProxy: forwarding request failed' and returns 500 with 'log request failed'. The provider address comes from the gateway's URL resolver, typically the functions_provider_url/upstream configuration.
Source
Thrown at gateway/handlers/logs.go:65
wf, ok := w.(writerFlusher)
if !ok {
log.Println("LogHandler: response is not a Flusher, required for streaming response")
http.NotFound(w, r)
return
}
if writeRequestURI {
log.Printf("LogProxy: proxying request to %s %s\n", logRequest.Host, logRequest.URL.String())
}
ctx, cancel := context.WithCancel(ctx)
logRequest = logRequest.WithContext(ctx)
defer cancel()
logResp, err := http.DefaultTransport.RoundTrip(logRequest)
if err != nil {
log.Printf("LogProxy: forwarding request failed: %s\n", err.Error())
http.Error(w, "log request failed", http.StatusInternalServerError)
return
}
defer logResp.Body.Close()
switch logResp.StatusCode {
case http.StatusNotFound, http.StatusNotImplemented:
w.WriteHeader(http.StatusNotImplemented)
return
case http.StatusOK:
// watch for connection closures and stream data
// connections and contexts should have cancel methods deferred already
select {
case err := <-copyNotify(&unbufferedWriter{wf}, logResp.Body):
if err != nil {
log.Printf("LogProxy: error while copy: %s", err.Error())
return
}
case <-cn.CloseNotify():View on GitHub (pinned to 8d803bf9e2)
Solutions
- From inside the gateway container, verify the provider answers: curl the provider /healthz or /system/functions endpoint
- Correct functions_provider_url so it points directly at the provider service
- Check the provider pod status and logs (kubectl get pods -n openfaas, kubectl logs on the provider deployment)
- Review NetworkPolicies or service mesh rules between gateway and provider namespaces
- If DNS fails, confirm the provider service exists and the namespace suffix is correct
Defensive patterns
Strategy: retry
Validate before calling
# preflight: provider reachable before streaming logs curl -fsS "$FUNCTIONS_PROVIDER_URL/healthz" || echo 'provider unreachable: log streaming will fail'
Try / catch
resp, err := client.Get(logsURL)
if err != nil || resp.StatusCode == http.StatusInternalServerError {
// transport failure to the provider: back off and retry
time.Sleep(backoff)
continue
} Prevention
- Health-check the provider before opening log streams
- Keep functions_provider_url pinned to a stable service DNS name
- Alert on the gateway log line 'LogProxy: forwarding request failed' to catch provider outages early
When it happens
Trigger: Calling GET /system/logs?name=myfn&follow=true while the provider (faas-netes, faasd, or another faas-provider implementation) cannot be reached: wrong upstream host or port, provider pod not running or not ready, NetworkPolicy blocking gateway-to-provider traffic, or a TLS certificate mismatch on the upstream.
Common situations: functions_provider_url pointing at a stale ClusterIP or wrong port after a reinstall; provider crash-looping; CNI/NetworkPolicy changes blocking namespace-local traffic; faasd address or socket changed.
Related errors
- unknown log request error (%v)
- string(upstreamBody)
- A body is required for this endpoint
- err.Error()
- Error queuing request: %s
AI-assisted analysis of openfaas/faas@8d803bf9e2 (2026-08-16).
Data as JSON: /api/errors/a7819099ce2bba98.
Report an issue: GitHub.