diff --git a/packages/cli/src/commands/create-github-app/index.ts b/packages/cli/src/commands/create-github-app/index.ts index 617ae12f36..32fa1e9a6d 100644 --- a/packages/cli/src/commands/create-github-app/index.ts +++ b/packages/cli/src/commands/create-github-app/index.ts @@ -51,10 +51,22 @@ integrations: }; async function verifyGithubOrg(org: string): Promise { - const response = await fetch( - `https://api.github.com/orgs/${encodeURIComponent(org)}`, - ); - if (!response.ok) { + let response; + + try { + response = await fetch( + `https://api.github.com/orgs/${encodeURIComponent(org)}`, + ); + } catch (e) { + console.log( + chalk.yellow( + 'Warning: Unable to verify existence of GitHub organization. ', + e, + ), + ); + } + + if (response?.status === 404) { throw new Error( `GitHub organization '${org}' does not exist. Please verify the name and try again.`, );