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/disable-sentry-by-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Disable Sentry error reporting by default

`WRANGLER_SEND_ERROR_REPORTS` now defaults to `false` instead of prompting on every error. The current prompt produces too many false-positive reports. Users can still opt in explicitly by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
37 changes: 37 additions & 0 deletions .changeset/pipeline-stream-rename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
"wrangler": minor
"@cloudflare/workers-utils": minor
"miniflare": minor
---

Rename `pipeline` field to `stream` in pipeline bindings configuration

The `pipeline` field inside `pipelines` bindings has been renamed to `stream` to align with the updated API wire format. The old `pipeline` field is still accepted but deprecated and will emit a warning.

Before:

```jsonc
// wrangler.json
{
"pipelines": [
{
"binding": "MY_PIPELINE",
"pipeline": "my-stream-name",
},
],
}
```

After:

```jsonc
// wrangler.json
{
"pipelines": [
{
"binding": "MY_PIPELINE",
"stream": "my-stream-name",
},
],
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"pipelines": [
{
"binding": "PIPELINE",
"pipeline": "my-pipeline",
"stream": "my-pipeline",
},
],
}
16 changes: 13 additions & 3 deletions packages/miniflare/src/plugins/pipelines/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export const PipelineOptionsSchema = z.object({
z.union([
z.string(),
z.object({
stream: z.string(),
remoteProxyConnectionString: z
.custom<RemoteProxyConnectionString>()
.optional(),
}),
z.object({
/** @deprecated Use `stream` instead. */
pipeline: z.string(),
remoteProxyConnectionString: z
.custom<RemoteProxyConnectionString>()
Expand Down Expand Up @@ -79,7 +86,9 @@ function bindingEntries(
string,
| string
| {
pipeline: string;
stream?: string;
/** @deprecated Use `stream` instead. */
pipeline?: string;
remoteProxyConnectionString?: RemoteProxyConnectionString;
}
>
Expand All @@ -97,7 +106,8 @@ function bindingEntries(
(
| string
| {
pipeline: string;
stream?: string;
pipeline?: string;
remoteProxyConnectionString?: RemoteProxyConnectionString;
}
),
Expand All @@ -107,7 +117,7 @@ function bindingEntries(
typeof opts === "string"
? { id: opts }
: {
id: opts.pipeline,
id: opts.stream ?? opts.pipeline ?? "",
remoteProxyConnectionString: opts.remoteProxyConnectionString,
},
]);
Expand Down
9 changes: 7 additions & 2 deletions packages/workers-utils/src/config/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,13 @@ export interface EnvironmentNonInheritable {
pipelines: {
/** The binding name used to refer to the bound service. */
binding: string;
/** Name of the Pipeline to bind */
pipeline: string;
/** Id of the Stream to bind */
stream?: string;
/**
* Id of the Stream to bind
* @deprecated Use `stream` instead.
*/
pipeline?: string;
/** Whether the pipeline should be remote or not in local development */
remote?: boolean;
}[];
Expand Down
19 changes: 16 additions & 3 deletions packages/workers-utils/src/config/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4841,7 +4841,7 @@ const validatePipelineBinding: ValidatorFn = (diagnostics, field, value) => {
return false;
}
let isValid = true;
// Pipeline bindings must have a binding and a pipeline.
// Pipeline bindings must have a binding and a stream (or deprecated pipeline).
if (!isRequiredProperty(value, "binding", "string")) {
diagnostics.errors.push(
`"${field}" bindings must have a string "binding" field but got ${JSON.stringify(
Expand All @@ -4850,9 +4850,21 @@ const validatePipelineBinding: ValidatorFn = (diagnostics, field, value) => {
);
isValid = false;
}
if (!isRequiredProperty(value, "pipeline", "string")) {

const hasStream = isOptionalProperty(value, "stream", "string");
const hasPipeline = isOptionalProperty(value, "pipeline", "string");
const v = value as Record<string, unknown>;

if (hasStream && v.stream) {
// "stream" is the primary field — use it as-is
} else if (hasPipeline && v.pipeline) {
// Deprecated "pipeline" field — normalize to "stream"
diagnostics.warnings.push(
`The "pipeline" field in "${field}" bindings is deprecated. Use "stream" instead.`
);
} else {
diagnostics.errors.push(
`"${field}" bindings must have a string "pipeline" field but got ${JSON.stringify(
`"${field}" bindings must have a string "stream" field but got ${JSON.stringify(
value
)}.`
);
Expand All @@ -4865,6 +4877,7 @@ const validatePipelineBinding: ValidatorFn = (diagnostics, field, value) => {

validateAdditionalProperties(diagnostics, field, Object.keys(value), [
"binding",
"stream",
"pipeline",
"remote",
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ export const getWranglerSendMetricsFromEnv =
});

/**
* `WRANGLER_SEND_ERROR_REPORTS` can override whether we attempt to send error reports to Sentry.
* `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.
*
* Defaults to `false` to avoid noisy false-positive reports. Users can opt in
* by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
*/
export const getWranglerSendErrorReportsFromEnv =
getBooleanEnvironmentVariableFactory({
variableName: "WRANGLER_SEND_ERROR_REPORTS",
defaultValue: false,
});

/**
Expand Down
5 changes: 4 additions & 1 deletion packages/workers-utils/src/map-worker-metadata-bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ export function mapWorkerMetadataBindings(
...(configObj.pipelines ?? []),
{
binding: binding.name,
pipeline: binding.pipeline,
// NOTE: stream is the primary field, but we also support pipeline for backward compatibility
...(binding.stream && { stream: binding.stream }),

...(binding.pipeline && { pipeline: binding.pipeline }),
},
];
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/workers-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export type WorkerMetadataBinding =
};
}
| { type: "mtls_certificate"; name: string; certificate_id: string }
| { type: "pipelines"; name: string; pipeline: string }
| { type: "pipelines"; name: string; stream?: string; pipeline?: string }
| {
type: "secrets_store_secret";
name: string;
Expand Down
3 changes: 2 additions & 1 deletion packages/workers-utils/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ export interface CfAssetsBinding {

export interface CfPipeline {
binding: string;
pipeline: string;
stream?: string;
pipeline?: string;
remote?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4499,7 +4499,28 @@ describe("normalizeAndValidateConfig()", () => {
`);
});

it("should accept valid bindings", ({ expect }) => {
it("should accept valid bindings with stream field", ({ expect }) => {
const { diagnostics } = normalizeAndValidateConfig(
{
pipelines: [
{
binding: "VALID",
stream: "343cd4f1d58c42fbb5bd082592fd7143",
},
],
} as unknown as RawConfig,
undefined,
undefined,
{ env: undefined }
);

expect(diagnostics.hasErrors()).toBe(false);
expect(diagnostics.hasWarnings()).toBe(false);
});

it("should accept deprecated pipeline field with warning", ({
expect,
}) => {
const { diagnostics } = normalizeAndValidateConfig(
{
pipelines: [
Expand All @@ -4515,6 +4536,11 @@ describe("normalizeAndValidateConfig()", () => {
);

expect(diagnostics.hasErrors()).toBe(false);
expect(diagnostics.hasWarnings()).toBe(true);
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- The "pipeline" field in "pipelines[0]" bindings is deprecated. Use "stream" instead."
`);
});

it("should error if pipelines.bindings are not valid", ({ expect }) => {
Expand All @@ -4524,7 +4550,7 @@ describe("normalizeAndValidateConfig()", () => {
{},
{
binding: "VALID",
pipeline: "343cd4f1d58c42fbb5bd082592fd7143",
stream: "343cd4f1d58c42fbb5bd082592fd7143",
},
{ binding: 2000, project: 2111 },
],
Expand All @@ -4541,9 +4567,9 @@ describe("normalizeAndValidateConfig()", () => {
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- "pipelines[0]" bindings must have a string "binding" field but got {}.
- "pipelines[0]" bindings must have a string "pipeline" field but got {}.
- "pipelines[0]" bindings must have a string "stream" field but got {}.
- "pipelines[2]" bindings must have a string "binding" field but got {"binding":2000,"project":2111}.
- "pipelines[2]" bindings must have a string "pipeline" field but got {"binding":2000,"project":2111}."
- "pipelines[2]" bindings must have a string "stream" field but got {"binding":2000,"project":2111}."
`);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@ describe("createWorkerUploadForm — bindings", () => {
describe("pipeline bindings", () => {
it("should transform type from pipeline to pipelines", ({ expect }) => {
const bindings: StartDevWorkerInput["bindings"] = {
MY_PIPELINE: { type: "pipeline", pipeline: "my-pipeline" },
MY_PIPELINE: { type: "pipeline", stream: "my-pipeline" },
};
const form = createWorkerUploadForm(createEsmWorker(), bindings);
expect(getBindings(form)).toContainEqual({
name: "MY_PIPELINE",
type: "pipelines",
pipeline: "my-pipeline",
stream: "my-pipeline",
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ describe("deploy", () => {
pipelines: [
{
binding: "MY_PIPELINE",
pipeline: "my-pipeline",
stream: "my-pipeline",
},
],
});
Expand All @@ -1397,7 +1397,7 @@ describe("deploy", () => {
{
type: "pipelines",
name: "MY_PIPELINE",
pipeline: "my-pipeline",
stream: "my-pipeline",
},
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe("getRemoteConfigsDiff", () => {
pipelines: [
{
binding: "MY_PIPELINE",
pipeline: "my-pipeline",
stream: "my-pipeline",
},
],
vectorize: [
Expand Down Expand Up @@ -482,7 +482,7 @@ describe("getRemoteConfigsDiff", () => {
pipelines: [
{
binding: "MY_PIPELINE",
pipeline: "my-pipeline",
stream: "my-pipeline",
remote: true,
},
],
Expand Down
6 changes: 3 additions & 3 deletions packages/wrangler/src/__tests__/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ describe("init", () => {
{
type: "pipelines",
name: "PIPELINE_BINDING",
pipeline: "some-name",
stream: "some-name",
},
{
type: "mtls_certificate",
Expand Down Expand Up @@ -564,7 +564,7 @@ describe("init", () => {
pipelines: [
{
binding: "PIPELINE_BINDING",
pipeline: "some-name",
stream: "some-name",
},
],
queues: {
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe("init", () => {
"pipelines": [
{
"binding": "PIPELINE_BINDING",
"pipeline": "some-name"
"stream": "some-name"
}
],
"mtls_certificates": [
Expand Down
Loading
Loading