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

Include Request ID in error message #2717

Merged
merged 2 commits into from
Aug 29, 2023
Merged

Conversation

amcaplan
Copy link
Contributor

@amcaplan amcaplan commented Aug 28, 2023

WHY are these changes introduced?

Fixes https://github.com/Shopify/develop-app-management/issues/168

Users often open bug reports without including a request ID. First thing we do is to ask them to generate a request ID for us. This should help us skip the step and resolve issues more quickly!

WHAT is this pull request doing?

Screenshot 2023-08-28 at 22 33 41

How to test your changes?

  1. Introduce a deliberate breakage into GraphQL, e.g. an incorrectly named field (I changed a field name in packages/app/src/cli/api/graphql/find_app.ts)
  2. Run a command that uses that query
  3. Observe the resulting error

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

This should cause users to include the request ID in their bug reports
by default.
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/api.d.ts
@@ -8,5 +8,5 @@ interface RequestOptions<T> {
 export declare function debugLogResponseInfo<T extends {
     headers: Headers;
     status: number;
-}>({ request, url }: RequestOptions<T>, errorHandler?: (error: unknown) => Error | unknown): Promise<T>;
+}>({ request, url }: RequestOptions<T>, errorHandler?: (error: unknown, requestId: string | undefined) => Error | unknown): Promise<T>;
 export {};
\ No newline at end of file
packages/cli-kit/dist/private/node/api/graphql.d.ts
@@ -2,4 +2,4 @@ import { RequestDocument, Variables } from 'graphql-request';
 export declare function debugLogRequestInfo<T>(api: string, query: RequestDocument, variables?: Variables, headers?: {
     [key: string]: string;
 }): void;
-export declare function errorHandler<T>(api: string): (error: unknown) => Error | unknown;
\ No newline at end of file
+export declare function errorHandler<T>(api: string): (error: unknown, requestId?: string) => Error | unknown;
\ No newline at end of file

@github-actions
Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
74.45% (-0.01% 🔻)
5894/7917
🟡 Branches
71.61% (-0.01% 🔻)
2885/4029
🟡 Functions 73.11% 1512/2068
🟡 Lines
75.98% (-0.01% 🔻)
5599/7369
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / graphql.ts
6.25% (-0.89% 🔻)
0% 25%
6.25% (-0.89% 🔻)

Test suite run success

1423 tests passing in 667 suites.

Report generated by 🧪jest coverage report action from 6ab0ce1

@amcaplan amcaplan added this pull request to the merge queue Aug 29, 2023
Merged via the queue into main with commit d9cbe5c Aug 29, 2023
@amcaplan amcaplan deleted the include-request-id-in-error-message branch August 29, 2023 09:28
@shopify-shipit shopify-shipit bot temporarily deployed to nightly August 30, 2023 06:15 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production September 6, 2023 13:17 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to stable_3_49 September 6, 2023 17:54 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants