openfaas/faas · error
err.Error()
Error message
err.Error()
What it means
MakeQueuedProxy, which serves POST /async-function/{name}, buffers the whole request body with io.ReadAll before enqueueing. If the read itself fails, the raw Go error text is echoed to the client with status 400. A read failure means the transfer was broken or malformed — the queue has not been contacted yet at this point.
Source
Thrown at gateway/handlers/queue_proxy.go:34
"github.com/gorilla/mux"
ftypes "github.com/openfaas/faas-provider/types"
"github.com/openfaas/faas/gateway/metrics"
"github.com/openfaas/faas/gateway/pkg/middleware"
"github.com/openfaas/faas/gateway/scaling"
)
// MakeQueuedProxy accepts work onto a queue
func MakeQueuedProxy(metrics metrics.MetricOptions, queuer ftypes.RequestQueuer, pathTransformer middleware.URLPathTransformer, defaultNS string, functionQuery scaling.FunctionQuery) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var body []byte
if r.Body != nil {
defer r.Body.Close()
var err error
body, err = io.ReadAll(r.Body)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
}
callbackURL, err := getCallbackURLHeader(r.Header)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
vars := mux.Vars(r)
name := vars["name"]
req := &ftypes.QueueRequest{
Function: name,
Body: body,
Method: r.Method,
QueryString: r.URL.RawQuery,View on GitHub (pinned to 8d803bf9e2)
Solutions
- Retry the invocation — mid-body disconnects are usually transient
- Reduce the payload size; async bodies are fully buffered and additionally limited by the queue backend
- Raise body-size/buffering limits on any ingress proxy in front of the gateway
- Use a standard HTTP client library so chunked encoding and headers are well-formed
- Inspect the echoed error text ('unexpected EOF', 'malformed HTTP chunked encoding') to identify the failing layer
Defensive patterns
Strategy: retry
Try / catch
resp, err := client.Post(asyncURL, contentType, bytes.NewReader(body))
if err != nil || resp.StatusCode == http.StatusBadRequest {
// body transfer was interrupted: replay the buffered body after backoff
time.Sleep(backoff)
continue
} Prevention
- Send async payloads from an in-memory buffer so requests are replayable
- Keep async bodies small — they are fully buffered and also limited by the queue backend
- Tune or disable request-body size limits on proxies in front of the gateway
When it happens
Trigger: Client disconnects or times out mid-upload; malformed chunked transfer encoding; an intermediary (nginx, Traefik, Istio) resets the connection when a body-size or buffering limit is exceeded; keep-alive connection races.
Common situations: Large async payloads exceeding proxy limits (nginx client_max_body_size, Traefik body limits); SDKs with aggressive client timeouts aborting during upload; flaky client networks; custom clients hand-rolling chunked encoding.
Related errors
- A body is required for this endpoint
- Error reading request body
- invalid value for max_idle_conns: %s
- invalid value for max_idle_conns_per_host: %s
- log request failed
AI-assisted analysis of openfaas/faas@8d803bf9e2 (2026-08-16).
Data as JSON: /api/errors/6d67949101efadf1.
Report an issue: GitHub.