@norskvideo/ctl-dev-kit 0.1.29 → 0.1.31

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.
@@ -21,7 +21,14 @@ const STRIP_RESPONSE_HEADERS = ["content-encoding", "content-length", "transfer-
21
21
  * path segment (the dashboard is served at `/dashboard/<dashboardKey>/`). */
22
22
  export function startInstanceProxy(opts) {
23
23
  const prefix = `/instance/${opts.instanceId}`;
24
- const httpUpstream = `http://localhost:${opts.studioHostPort}`;
24
+ // Studio's published port is on localhost for a local run, but in the
25
+ // docker-outside-of-docker CI the test process runs in a container and the
26
+ // port lives on the host gateway — reach it via NORSK_TEST_HOST
27
+ // (host.docker.internal), mirroring @norskvideo/ctl-test-harness's STUDIO_HOST.
28
+ // Without this the proxy's own fetch/WebSocket dials localhost inside the
29
+ // runner container and ConnectionRefuses, so the baked dashboard never loads.
30
+ const upstreamHost = process.env.NORSK_TEST_HOST ?? "localhost";
31
+ const httpUpstream = `http://${upstreamHost}:${opts.studioHostPort}`;
25
32
  const strip = (pathname) => pathname === prefix ? "/" : pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;
26
33
  const server = Bun.serve({
27
34
  port: 0,
@@ -29,7 +36,7 @@ export function startInstanceProxy(opts) {
29
36
  const u = new URL(req.url);
30
37
  const path = strip(u.pathname);
31
38
  if (req.headers.get("upgrade")?.toLowerCase() === "websocket") {
32
- const upstreamUrl = `ws://localhost:${opts.studioHostPort}${path}${u.search}`;
39
+ const upstreamUrl = `ws://${upstreamHost}:${opts.studioHostPort}${path}${u.search}`;
33
40
  const ok = srv.upgrade(req, { data: { upstreamUrl, upstream: null, queue: [] } });
34
41
  return ok ? undefined : new Response("ws upgrade failed", { status: 400 });
35
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-dev-kit",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",