Skip to content

Commit 6d62eeb

Browse files
committed
fixes
1 parent efb7c52 commit 6d62eeb

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

packages/miniflare/src/index.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -767,17 +767,17 @@ export class Miniflare {
767767
});
768768
// Add custom headers included in response to WebSocket upgrade requests
769769
this.#webSocketExtraHeaders = new WeakMap();
770-
// this.#webSocketServer.on("headers", (headers, req) => {
771-
// const extra = this.#webSocketExtraHeaders.get(req);
772-
// this.#webSocketExtraHeaders.delete(req);
773-
// if (extra) {
774-
// for (const [key, value] of extra) {
775-
// if (!restrictedWebSocketUpgradeHeaders.includes(key.toLowerCase())) {
776-
// headers.push(`${key}: ${value}`);
777-
// }
778-
// }
779-
// }
780-
// });
770+
this.#webSocketServer.on("headers", (headers, req) => {
771+
const extra = this.#webSocketExtraHeaders.get(req);
772+
this.#webSocketExtraHeaders.delete(req);
773+
if (extra) {
774+
for (const [key, value] of extra) {
775+
if (!restrictedWebSocketUpgradeHeaders.includes(key.toLowerCase())) {
776+
headers.push(`${key}: ${value}`);
777+
}
778+
}
779+
}
780+
});
781781

782782
// Build path for temporary directory. We don't actually want to create this
783783
// unless it's needed (i.e. we have Durable Objects enabled). This means we
@@ -1046,7 +1046,7 @@ export class Miniflare {
10461046
http.createServer(this.#handleLoopback),
10471047
/* grace */ 0
10481048
);
1049-
// server.on("upgrade", this.#handleLoopbackUpgrade);
1049+
server.on("upgrade", this.#handleLoopbackUpgrade);
10501050
server.listen(0, hostname, () => resolve(server));
10511051
});
10521052
}

packages/wrangler/src/__tests__/deploy.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { http, HttpResponse } from "msw";
1010
import dedent from "ts-dedent";
1111
import { File } from "undici";
1212
import { vi } from "vitest";
13-
import * as checkCommand from "../check/commands";
1413
import {
1514
printBundleSize,
1615
printOffendingDependencies,

packages/wrangler/src/check/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import events from "node:events";
44
import { writeFile } from "node:fs/promises";
55
import path from "path";
66
import { log } from "@cloudflare/cli";
7-
import { spinner, spinnerWhile } from "@cloudflare/cli/interactive";
7+
import { spinnerWhile } from "@cloudflare/cli/interactive";
88
import chalk from "chalk";
99
import { Miniflare } from "miniflare";
1010
import { WebSocket } from "ws";

packages/wrangler/src/deploy/deploy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
33
import path from "node:path";
44
import { URLSearchParams } from "node:url";
55
import { cancel } from "@cloudflare/cli";
6-
import { FormData, Response } from "undici";
6+
import { Response } from "undici";
77
import { syncAssets } from "../assets";
88
import { fetchListResult, fetchResult } from "../cfetch";
99
import { configFileName, formatConfigSnippet } from "../config";
@@ -74,6 +74,7 @@ import type { PostQueueBody, PostTypedConsumerBody } from "../queues/client";
7474
import type { LegacyAssetPaths } from "../sites";
7575
import type { RetrieveSourceMapFunction } from "../sourcemap";
7676
import type { ApiVersion, Percentage, VersionId } from "../versions/types";
77+
import type { FormData } from "undici";
7778

7879
type Props = {
7980
config: Config;

packages/wrangler/src/deploy/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,6 @@ async function deployWorker(args: DeployArgs) {
311311
);
312312
}
313313

314-
if (args.outfile && args.outdir) {
315-
throw new UserError("Cannot use `--outfile` and `--outdir` together");
316-
}
317-
318314
if (config.workflows?.length) {
319315
logger.once.warn("Workflows is currently in open beta.");
320316
}

packages/wrangler/src/utils/friendly-validator-errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export async function helpIfErrorIsSizeOrScriptStartup(
6666
await writeFile(profile, JSON.stringify(cpuProfile));
6767
throw new UserError(dedent`
6868
Your Worker failed validation because it exceeded startup limits.
69-
To ensure fast responses, we place constraints on Worker startup—like how much CPU it can use, or how long it can take. Your Worker failed validation, which means it hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
69+
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
7070
71-
A CPU Profile of your Worker's startup phase has been written to ${profile} Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.
71+
A CPU Profile of your Worker's startup phase has been written to ${profile} - load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.
7272
7373
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`);
7474
}

packages/wrangler/src/versions/upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import assert from "node:assert";
22
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
33
import path from "node:path";
44
import { blue, gray } from "@cloudflare/cli/colors";
5-
import { FormData } from "undici";
65
import {
76
getAssetsOptions,
87
syncAssets,
@@ -61,6 +60,7 @@ import type { Rule } from "../config/environment";
6160
import type { Entry } from "../deployment-bundle/entry";
6261
import type { CfPlacement, CfWorkerInit } from "../deployment-bundle/worker";
6362
import type { RetrieveSourceMapFunction } from "../sourcemap";
63+
import type { FormData } from "undici";
6464

6565
type Props = {
6666
config: Config;

0 commit comments

Comments
 (0)