openfaas/faas · error
Error queuing request: %s
Error message
Error queuing request: %s
What it means
After building the QueueRequest, MakeQueuedProxy publishes it through the configured RequestQueuer (nats-queue in the standard OpenFaaS stack). A publish failure returns 500 with 'Error queuing request: <err>'. Only a successful publish yields 202 Accepted, so this error means the async invocation was not accepted at all.
Source
Thrown at gateway/handlers/queue_proxy.go:61
}
vars := mux.Vars(r)
name := vars["name"]
req := &ftypes.QueueRequest{
Function: name,
Body: body,
Method: r.Method,
QueryString: r.URL.RawQuery,
Path: pathTransformer.Transform(r),
Header: r.Header,
Host: r.Host,
CallbackURL: callbackURL,
}
if err = queuer.Queue(req); err != nil {
log.Printf("Error queuing request: %v", err)
http.Error(w, fmt.Sprintf("Error queuing request: %s", err.Error()),
http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusAccepted)
}
}
func getCallbackURLHeader(header http.Header) (*url.URL, error) {
value := header.Get("X-Callback-Url")
var callbackURL *url.URL
if len(value) > 0 {
urlVal, err := url.Parse(value)
if err != nil {
return callbackURL, err
}
View on GitHub (pinned to 8d803bf9e2)
Solutions
- Check queue health: kubectl get pods -n openfaas and confirm the nats pod is Running/Ready
- Verify connectivity to NATS port 4222 from the cluster (nc -z nats.openfaas.svc 4222)
- Reduce the async payload below the NATS max_payload limit or raise the limit
- Read the embedded error text ('nats: connection closed', 'payload too large') — it names the exact failure
- Restart the queue connector if its NATS connection is stale
Defensive patterns
Strategy: retry
Validate before calling
# preflight: NATS reachable before firing async requests nc -z nats.openfaas 4222 || echo 'NATS down: /async-function/* calls will fail'
Try / catch
resp, err := client.Post(asyncURL, contentType, body)
if err != nil || resp.StatusCode == http.StatusInternalServerError {
// queue backend unavailable: wait, then re-enqueue the whole job
time.Sleep(backoff)
continue
} Prevention
- Monitor the nats-streaming pod and alert before it degrades
- Keep async payloads under the NATS max_payload (default 1MB)
- Treat 202 Accepted as the only success signal — anything else means the job was not queued
- Persist jobs locally so failed enqueues can be replayed
When it happens
Trigger: POST /async-function/{name} while the queue backend is unavailable: nats-streaming pod down or not ready, wrong NATS address or port (4222), the request body exceeding NATS max_payload (default 1MB), or the queue connector crashed.
Common situations: nats-streaming StatefulSet not running or evicted; chart installed without queue mode; NATS max_payload smaller than the async body; resource limits killing the streaming server.
Related errors
AI-assisted analysis of openfaas/faas@8d803bf9e2 (2026-08-16).
Data as JSON: /api/errors/ddc49aaafdbbcb8f.
Report an issue: GitHub.