---
title: serve_wsgi_request
summary: Serve a single WSGI request using the Fastly Compute API.
url: https://www.fastly.com/documentation/reference/compute/sdks/python/fastly_compute/wsgi/fn.serve_wsgi_request/
---

**Kind:** Function  
**Module:** [wsgi](https://www.fastly.com/documentation/reference/compute/sdks/python/fastly_compute/wsgi/)  
**Package:** fastly-compute 0.1.3  
**Source:** https://github.com/fastly/compute-sdk-python/blob/2bffcc6d596a68bcc0b4342404641deff78e68f6/fastly_compute/wsgi.py#L31

```python
serve_wsgi_request(req: http_req.Request, body: InputStream, app: Callable, handle_errors: bool = False) -> None
```

Serve a single WSGI request using the Fastly Compute API.

This function adapts between Fastly's WIT-based HTTP API and the WSGI
specification, allowing any WSGI-compatible web framework to run on
Fastly Compute.

**Parameters**

- `req`: `http_req.Request` — Fastly HTTP request object from WIT bindings
- `body`: `InputStream` — WSGI input stream containing the request body (PEP 3333 compliant)
- `app`: `Callable` — WSGI application callable
- `handle_errors`: `bool` (optional) = `False`

  If True, log exceptions and return 500; otherwise let
  the server or WSGI app handle them

**Returns**

`None`
