Skip to content

Commit 46d9c55

Browse files
authored
Return more useful error when reaching /api/keystatic/github/created-app route when the GitHub App is already setup (#1364)
1 parent 0b0864f commit 46d9c55

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/sour-ravens-know.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@keystatic/core': patch
3+
---
4+
5+
Return more useful error when reaching `/api/keystatic/github/created-app` route when the GitHub App is already setup

packages/keystatic/src/api/generic.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ export function makeGenericAPIRouteHandler(
177177
['Set-Cookie', immediatelyExpiringCookie('keystatic-gh-refresh-token')],
178178
]);
179179
}
180+
if (joined === 'github/created-app') {
181+
return {
182+
status: 404,
183+
body: 'It looks like you just tried to create a GitHub App for Keystatic but there is already a GitHub App configured for Keystatic.\n\nYou may be here because you started creating a GitHub App but then started the process again elsewhere and completed it there. You should likely go back to Keystatic and sign in with GitHub to continue.',
184+
};
185+
}
180186
return { status: 404, body: 'Not Found' };
181187
};
182188
}

0 commit comments

Comments
 (0)