Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(vercel): return a bare 204 from the Vercel proxy (#107967)

Matt Brookerc8435c56f368
diff --git a/ee/api/vercel/test/test_vercel_proxy.py b/ee/api/vercel/test/test_vercel_proxy.py
index c5561023f485..1cbb8c8455c6 100644
--- a/ee/api/vercel/test/test_vercel_proxy.py
+++ b/ee/api/vercel/test/test_vercel_proxy.py
@@ -122,6 +122,29 @@ class TestVercelProxyAPI(APIBaseTest):
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert response.json() == {"error": "Invalid invoice data"}
+ @patch("ee.api.vercel.vercel_proxy.forward_to_vercel")
+ def test_proxy_returns_vercel_204_without_body(self, mock_forward, mock_license):
+ mock_license.return_value = self.license
+
+ vercel_response = req.Response()
+ vercel_response.status_code = status.HTTP_204_NO_CONTENT
+ vercel_response._content = b""
+ mock_forward.return_value = vercel_response
+
+ response = self.unauthenticated_client.post(
+ "/api/vercel/proxy/",
+ {
+ "path": "/billing/invoices/inv_123/actions",
+ "method": "POST",
+ "body": {"action": "refund", "reason": "Duplicate charge", "total": "10.00"},
+ },
+ format="json",
+ **self._get_auth_headers(),
+ )
+
+ assert response.status_code == status.HTTP_204_NO_CONTENT
+ assert response.headers.get("Content-Length", "0") == "0"
+
def test_proxy_rejects_missing_token(self, mock_license):
mock_license.return_value = self.license
diff --git a/ee/api/vercel/vercel_proxy.py b/ee/api/vercel/vercel_proxy.py
index f464ed22818e..30c5efad39db 100644
--- a/ee/api/vercel/vercel_proxy.py
+++ b/ee/api/vercel/vercel_proxy.py
@@ -183,6 +183,9 @@ class VercelProxyViewSet(viewsets.ViewSet):
self._log_vercel_response(vercel_response, config_id, path)
+ if vercel_response.status_code == status.HTTP_204_NO_CONTENT:
+ return Response(status=status.HTTP_204_NO_CONTENT)
+
try:
response_data = vercel_response.json()
except requests.JSONDecodeError: