Skip to content

Commit

Permalink
Catch access denied error during init flow
Browse files Browse the repository at this point in the history
Developers are hitting this error when they try to create a new
Hydrogen storefront on a Development Store. This catches that error and
provides some better feedback on why it failed.
  • Loading branch information
graygilmore committed Aug 28, 2023
1 parent 06516ee commit 8672e4d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/cli/src/lib/graphql/admin/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ export async function adminRequest<T>(
);
}

if (
errors?.some?.((error) =>
error.message.includes(
'Access denied for hydrogenStorefrontCreate field',
),
)
) {
throw new AbortError("Couldn't connect storefront to Shopify", [
'Common reasons for this error include:',
{
list: {
items: [
"The Hydrogen sales channel isn't installed on the store.",
"You don't have the required account permission to manage apps or channels.",
"You're trying to connect to an ineligible store type (Trial, Development store)",
],
},
},
]);
}

throw error;
}
}

0 comments on commit 8672e4d

Please sign in to comment.