@norskvideo/ctl-dev-kit 0.2.36 → 0.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/doc-guide/instance-proxy.js +16 -6
- package/package.json +1 -1
|
@@ -88,12 +88,22 @@ export async function startInstanceProxy(opts) {
|
|
|
88
88
|
const headers = new Headers(req.headers);
|
|
89
89
|
headers.delete("host");
|
|
90
90
|
const body = req.method === "GET" || req.method === "HEAD" ? undefined : await req.arrayBuffer();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
// Studio being briefly unreachable is ordinary while a guide polls it; a
|
|
92
|
+
// throw here escapes as an unhandled error and fails every guide in the run.
|
|
93
|
+
let upstream;
|
|
94
|
+
try {
|
|
95
|
+
upstream = await fetch(`${httpUpstream}${path}${u.search}`, {
|
|
96
|
+
method: req.method,
|
|
97
|
+
headers,
|
|
98
|
+
body,
|
|
99
|
+
redirect: "manual",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
return new Response(`instance proxy: upstream unreachable: ${e instanceof Error ? e.message : String(e)}`, {
|
|
104
|
+
status: 502,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
97
107
|
const outHeaders = new Headers(upstream.headers);
|
|
98
108
|
for (const h of STRIP_RESPONSE_HEADERS)
|
|
99
109
|
outHeaders.delete(h);
|