Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wrangler] fix: don't suggest reporting UserErrors to GitHub #5030

Merged
merged 1 commit into from
Feb 16, 2024
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/four-comics-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: don't suggest reporting user errors to GitHub

Wrangler has two different types of errors: internal errors caused by something going wrong, and user errors caused by an invalid configuration. Previously, we would encourage users to submit bug reports for user errors, even though there's nothing we can do to fix them. This change ensures we only suggest this for internal errors.
79 changes: 21 additions & 58 deletions packages/wrangler/src/__tests__/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1609,10 +1609,7 @@ addEventListener('fetch', event => {});`
- \\"site.bucket\\" is a required field."
`);

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -1777,10 +1774,7 @@ addEventListener('fetch', event => {});`
`"Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler deploy path/to/script\`) or the \`main\` config field."`
);

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler deploy path/to/script\`) or the \`main\` config field.

Expand Down Expand Up @@ -2058,8 +2052,7 @@ addEventListener('fetch', event => {});`

",
"info": "",
"out": "
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose",
"out": "",
"warn": "▲ [WARNING] The --assets argument is experimental and may change or break at any time

",
Expand All @@ -2085,8 +2078,7 @@ addEventListener('fetch', event => {});`

",
"info": "",
"out": "
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose",
"out": "",
"warn": "",
}
`);
Expand All @@ -2113,8 +2105,7 @@ addEventListener('fetch', event => {});`

",
"info": "",
"out": "
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose",
"out": "",
"warn": "",
}
`);
Expand All @@ -2140,8 +2131,7 @@ addEventListener('fetch', event => {});`

",
"info": "",
"out": "
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose",
"out": "",
"warn": "▲ [WARNING] Processing wrangler.toml configuration:

- \\"assets\\" fields are experimental and may change or break at any time.
Expand Down Expand Up @@ -2174,8 +2164,7 @@ addEventListener('fetch', event => {});`

",
"info": "",
"out": "
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose",
"out": "",
"warn": "▲ [WARNING] Processing wrangler.toml configuration:

- \\"assets\\" fields are experimental and may change or break at any time.
Expand Down Expand Up @@ -3068,10 +3057,7 @@ addEventListener('fetch', event => {});`
Building list of assets to upload...
+ large-file.0ea0637a45.txt (uploading new version of large-file.txt)"
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] File too-large-file.txt is too big, it should be under 25 MiB. See https://developers.cloudflare.com/workers/platform/limits#kv-limits

Expand Down Expand Up @@ -3204,10 +3190,7 @@ addEventListener('fetch', event => {});`
"Fetching list of already uploaded assets...
Building list of assets to upload..."
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] The asset path key \\"folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/folder/file.3da0d0cd12.txt\\" exceeds the maximum key size limit of 512. See https://developers.cloudflare.com/workers/platform/limits#kv-limits\\",

Expand Down Expand Up @@ -4669,10 +4652,9 @@ addEventListener('fetch', event => {});`
The \`main\` property in wrangler.toml should point to the file generated by the custom build."
`);
expect(std.out).toMatchInlineSnapshot(`
"Running custom build: node -e \\"4+4;\\"

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
"Running custom build: node -e \\"4+4;\\"
"
`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] The expected output file at \\"index.js\\" was not found after running custom build: node -e \\"4+4;\\".

Expand Down Expand Up @@ -4708,10 +4690,9 @@ addEventListener('fetch', event => {});`
\`\`\`"
`);
expect(std.out).toMatchInlineSnapshot(`
"Running custom build: node -e \\"4+4;\\"

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
"Running custom build: node -e \\"4+4;\\"
"
`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] The expected output file at \\".\\" was not found after running custom build: node -e \\"4+4;\\".

Expand Down Expand Up @@ -5682,10 +5663,7 @@ addEventListener('fetch', event => {});`
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.]
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -5793,10 +5771,7 @@ addEventListener('fetch', event => {});`
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.]
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -5948,10 +5923,7 @@ addEventListener('fetch', event => {});`
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.]
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -6027,10 +5999,7 @@ addEventListener('fetch', event => {});`
).rejects.toThrowErrorMatchingInlineSnapshot(
`"You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code"`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] You cannot configure [wasm_modules] with an ES module worker. Instead, import the .wasm module directly in your code

Expand Down Expand Up @@ -6170,10 +6139,7 @@ addEventListener('fetch', event => {});`
).rejects.toThrowErrorMatchingInlineSnapshot(
`"You cannot configure [text_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your wrangler.toml"`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] You cannot configure [text_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your wrangler.toml

Expand Down Expand Up @@ -6283,10 +6249,7 @@ addEventListener('fetch', event => {});`
).rejects.toThrowErrorMatchingInlineSnapshot(
`"You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your wrangler.toml"`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure \`[rules]\` in your wrangler.toml

Expand Down
8 changes: 2 additions & 6 deletions packages/wrangler/src/__tests__/dev.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,7 @@ describe("wrangler dev", () => {
`"Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler dev path/to/script\`) or the \`main\` config field."`
);

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler dev path/to/script\`) or the \`main\` config field.

Expand Down Expand Up @@ -699,8 +696,7 @@ describe("wrangler dev", () => {
`);
expect(std.out).toMatchInlineSnapshot(`
"Running custom build: node -e \\"4+4;\\"

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
"
`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] The expected output file at \\"index.js\\" was not found after running custom build: node -e \\"4+4;\\".
Expand Down
40 changes: 8 additions & 32 deletions packages/wrangler/src/__tests__/kv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,7 @@ describe("wrangler", () => {
`"A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."`
);

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".

Expand All @@ -778,10 +775,7 @@ describe("wrangler", () => {
).rejects.toThrowErrorMatchingInlineSnapshot(
`"someBinding has both a namespace ID and a preview ID. Specify \\"--preview\\" or \\"--preview false\\" to avoid writing data to the wrong namespace."`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] someBinding has both a namespace ID and a preview ID. Specify \\"--preview\\" or \\"--preview false\\" to avoid writing data to the wrong namespace.

Expand Down Expand Up @@ -949,10 +943,7 @@ describe("wrangler", () => {

"
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
});
});

Expand Down Expand Up @@ -1206,10 +1197,7 @@ describe("wrangler", () => {
).rejects.toThrowErrorMatchingInlineSnapshot(
`"A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".

Expand Down Expand Up @@ -1469,10 +1457,7 @@ describe("wrangler", () => {
"Unexpected JSON input from \\"keys.json\\".
Expected an array of key-value objects but got type \\"object\\"."
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.warn).toMatchInlineSnapshot(`""`);
});

Expand Down Expand Up @@ -1531,10 +1516,7 @@ describe("wrangler", () => {
The item at index 12 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"base64\\":\\"string\\"}"
`);

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] Unexpected key-value properties in \\"keys.json\\".

Expand Down Expand Up @@ -1673,10 +1655,7 @@ describe("wrangler", () => {
Expected an array of strings but got:
12354"
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.warn).toMatchInlineSnapshot(`""`);
});

Expand All @@ -1698,10 +1677,7 @@ describe("wrangler", () => {
The item at index 2 is type: \\"object\\" - {\\"key\\":\\"someKey\\"}
The item at index 3 is type: \\"object\\" - null"
`);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.warn).toMatchInlineSnapshot(`""`);
});
});
Expand Down
10 changes: 2 additions & 8 deletions packages/wrangler/src/__tests__/mtls-certificates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,7 @@ Expires on: ${oneYearLater.toLocaleDateString()}
).rejects.toMatchInlineSnapshot(
`[Error: certificate not found with name "my-cert"]`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
});

it("should not delete when many certificates are found by name", async () => {
Expand Down Expand Up @@ -542,10 +539,7 @@ Expires on: ${oneYearLater.toLocaleDateString()}
).rejects.toMatchInlineSnapshot(
`[Error: multiple certificates found with name "my-cert"]`
);
expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
});

it("should not delete when confirmation fails", async () => {
Expand Down
15 changes: 3 additions & 12 deletions packages/wrangler/src/__tests__/pages/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,13 @@ describe("pages", () => {
`"Must specify a directory of static assets to serve or a command to run or a proxy port."`
);

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
});

it("should display for pages:functions:build", async () => {
await expect(runWrangler("pages functions build")).rejects.toThrowError();

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
});

it("should display for pages:functions:optimize-routes", async () => {
Expand All @@ -67,10 +61,7 @@ describe("pages", () => {
)
).rejects.toThrowError();

expect(std.out).toMatchInlineSnapshot(`
"
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
`);
expect(std.out).toMatchInlineSnapshot(`""`);
});
});
});
Loading
Loading