Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/big-snails-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Print deploy warnings even in non-interactive contexts when strict mode is off

Currently, wrangler deploy checks whether the incoming deploy configuration has destructive conflicts with the current configuration. Previously, we only performed this check in interactive contexts, or if the `--strict` flag was passed in. Now this warning is always printed, and it remains non-blocking in non-interactive contexts.
5 changes: 5 additions & 0 deletions .changeset/edge-preview-cloudflarepreviews-domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/edge-preview-authenticated-proxy": patch
---

Internal infrastructure changes
70 changes: 44 additions & 26 deletions fixtures/browser-run/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
// test/index.spec.ts
import { rm } from "node:fs/promises";
import { resolve } from "path";
import { afterAll, beforeAll, describe, it } from "vitest";
import { afterAll, beforeAll, describe, it, TestOptions } from "vitest";
import { runWranglerDev } from "../../shared/src/run-wrangler-long-lived";

const BROWSER_RENDERING_RETRY = {
retry: {
condition: /Chrome readiness probe .* timed out|Test timed out/i,
count: 3,
delay: 1_000,
},
} satisfies TestOptions;

describe.sequential("Local Browser", () => {
let ip: string,
port: number,
Expand Down Expand Up @@ -47,33 +55,43 @@ describe.sequential("Local Browser", () => {
).resolves.toEqual("Please add an ?url=https://example.com/ parameter");
});

it("Run a browser, and check h1 text content", async ({ expect }) => {
await expect(
fetchText(
`http://${ip}:${port}/?lib=${lib}&url=https://example.com&action=select`
)
).resolves.toEqual("Example Domain");
});
it(
"Run a browser, and check h1 text content",
BROWSER_RENDERING_RETRY,
async ({ expect }) => {
await expect(
fetchText(
`http://${ip}:${port}/?lib=${lib}&url=https://example.com&action=select`
)
).resolves.toEqual("Example Domain");
}
);

it("Run a browser, and check p text content", async ({ expect }) => {
await expect(
fetchText(
`http://${ip}:${port}/?lib=${lib}&url=https://example.com&action=alter`
)
).resolves.toEqual(
`New paragraph text set by ${lib === "playwright" ? "Playwright" : "Puppeteer"}!`
);
});
it(
"Run a browser, and check p text content",
BROWSER_RENDERING_RETRY,
async ({ expect }) => {
await expect(
fetchText(
`http://${ip}:${port}/?lib=${lib}&url=https://example.com&action=alter`
)
).resolves.toEqual(
`New paragraph text set by ${lib === "playwright" ? "Playwright" : "Puppeteer"}!`
);
}
);

it("Disconnect a browser, and check its session connection status", async ({
expect,
}) => {
await expect(
fetchText(
`http://${ip}:${port}/?lib=${lib}&url=https://example.com&action=disconnect`
)
).resolves.toEqual(`Browser disconnected`);
});
it(
"Disconnect a browser, and check its session connection status",
BROWSER_RENDERING_RETRY,
async ({ expect }) => {
await expect(
fetchText(
`http://${ip}:${port}/?lib=${lib}&url=https://example.com&action=disconnect`
)
).resolves.toEqual(`Browser disconnected`);
}
);
});
}
});
55 changes: 40 additions & 15 deletions packages/deploy-helpers/src/shared/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ContainerNormalizedConfig } from "@cloudflare/containers-shared";
import type {
AssetsOptions,
LegacyAssetPaths,
CfPlacement,
CfModule,
CfModuleType,
Config,
EphemeralDirectory,
FetchResultFetcher,
Expand Down Expand Up @@ -41,20 +41,14 @@ export type DeployHelpersContext = {
* config.unsafe, config.tail_consumers).
*/
export type SharedDeployVersionsProps = {
config: Config;
/** Merged from args.script/config.main/config.site.entry-point/config.assets. */
entry: Entry;
/** From config.rules. */
rules: Config["rules"];
/** Merged: --name arg ?? config.name, with CI override applied. */
name: string;
workerNameOverridden: boolean;
/** Merged: --compatibility-date arg ?? config.compatibility_date. Still optional — validated as required in stage 4. */
/** Merged: --name arg ?? config.name, with CI override applied. Validated as required separately. */
name: string | undefined;
/** Merged: --compatibility-date arg ?? config.compatibility_date. Still optional — validated as required later. */
compatibilityDate: string | undefined;
/** Merged: --compatibility-flags arg ?? config.compatibility_flags. */
compatibilityFlags: string[];
/** computed based on compat date and args */
nodejsCompatMode: NodeJSCompatMode;
/** Merged from --assets arg and config.assets. */
assetsOptions: AssetsOptions | undefined;
/** Merged: --jsx-factory arg || config.jsx_factory. */
Expand Down Expand Up @@ -82,7 +76,6 @@ export type SharedDeployVersionsProps = {
* True only when config opts in (legacy_env: false) AND --env is specified.
*/
useServiceEnvApiPath: boolean;
placement: CfPlacement | undefined;
/** Output directory for the bundled Worker. From --outdir arg or a temp directory. */
destination: string | EphemeralDirectory;
/** From --dry-run arg. */
Expand All @@ -99,10 +92,16 @@ export type SharedDeployVersionsProps = {
message: string | undefined;
/** From --secrets-file arg. */
secretsFile: string | undefined;
/** From collectKeyValues(--var arg). Pre-resolved key-value pairs. */
var: Record<string, string>;
/** From collectKeyValues(--var arg). CLI-only vars; config vars flow separately via getBindings(config). */
cliVars: Record<string, string>;
/** From --experimental-auto-create arg. */
experimentalAutoCreate: boolean;
/** Resolved from requireAuth() before calling deploy-helpers. undefined only in dry-run. */
accountId: string | undefined;
/** Resolved from getMetricsUsageHeaders() / config.send_metrics. Controls whether usage metrics headers are sent with upload requests. */
sendMetrics: boolean;
/** Resolved from getFlag("RESOURCES_PROVISION"). Controls whether bindings are auto-provisioned before upload. */
resourcesProvision: boolean;
};

export type DeployProps = SharedDeployVersionsProps & {
Expand All @@ -116,7 +115,6 @@ export type DeployProps = SharedDeployVersionsProps & {
routes: Route[];
/** Merged: --logpush arg ?? config.logpush. */
logpush: boolean | undefined;
containers: ContainerNormalizedConfig[];
/** From --dispatch-namespace arg. Deploy-only (Workers for Platforms). */
dispatchNamespace: string | undefined;
/** From --strict arg. Deploy-only. */
Expand All @@ -125,6 +123,8 @@ export type DeployProps = SharedDeployVersionsProps & {
metafile: string | boolean | undefined;
/** From --old-asset-ttl arg. Deploy-only. */
oldAssetTtl: number | undefined;
/** From --containers-rollout arg. Deploy-only. */
containersRollout: "immediate" | "gradual" | "none" | undefined;
};

export type VersionsUploadProps = SharedDeployVersionsProps & {
Expand All @@ -134,6 +134,31 @@ export type VersionsUploadProps = SharedDeployVersionsProps & {
previewAlias: string | undefined;
};

export type BuildBundleInfo = {
sourceMapPath?: string | undefined;
sourceMapMetadata?: { tmpDir: string; entryDirectory: string } | undefined;
};

export type HandleBuildResult = {
modules: CfModule[];
dependencies: Record<string, { bytesInOutput: number }>;
resolvedEntryPointPath: string;
bundleType: CfModuleType;
content: string;
bundle: BuildBundleInfo;
};

export type HandleBuild = {
build: (
props: SharedDeployVersionsProps,
config: Config,
options: {
nodejsCompatMode: NodeJSCompatMode;
metafile?: string | boolean;
}
) => Promise<HandleBuildResult>;
};

export interface TriggerDeployment {
targets: string[];
error?: Error;
Expand Down
4 changes: 2 additions & 2 deletions packages/edge-preview-authenticated-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function handleRequest(request: Request, env: Env) {

/**
* Given a preview token, this endpoint allows for raw http calls to be inspected
* It must be called with a random subdomain (i.e. some-random-data.rawhttp.devprod.cloudflare.dev)
* It must be called with a random subdomain (i.e. some-random-data.rawhttp.cloudflarepreviews.com)
* for consistency with the preview endpoint. This is not currently used, but may be in future
*
* It requires two parameters, passed as headers:
Expand Down Expand Up @@ -285,7 +285,7 @@ async function handleRawHttp(request: Request, url: URL) {
* - `prewarm` A fire-and-forget prewarm endpoint to hit to start up the preview
* - `suffix` (optional) The pathname + search to hit on the preview worker once redirected
*
* It must be called with a random subdomain (i.e. some-random-data.preview.devprod.cloudflare.dev)
* It must be called with a random subdomain (i.e. some-random-data.preview.cloudflarepreviews.com)
* to provide cookie isolation for the preview.
*
* It will redirect to the suffix provide, setting a cookie with the `token` and `remote`
Expand Down
Loading
Loading