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

fix: throw helpful error on auth({ type: "installation" }) if installationId option is not set #135

Merged
merged 3 commits into from
Aug 2, 2020

Conversation

copperwall
Copy link
Member

An installationId is required in either createAuthApp or auth when using the installation auth type. This adds an error message to warn users when an installationId is missing.

Closes #64

An installationId is required in either `createAuthApp` or `auth` when
using the installation auth type. This adds an error message to warn
users when an installationId is missing.
@@ -55,7 +55,7 @@ const { createAppAuth } = require("@octokit/auth-app");
</td></tr>
<tr><td colspan=2>

⚠️ For usage in browsers: The private keys provide by GitHub are in `PKCS#1` format, but the WebCrypto API only supports `PKCS#8`. You need to convert it first:
⚠️ For usage in browsers: The private keys provided by GitHub are in `PKCS#1` format, but the WebCrypto API only supports `PKCS#8`. You need to convert it first:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the typo fix!

@@ -16,6 +16,12 @@ export async function getInstallationAuthentication(
const installationId = (options.installationId ||
state.installationId) as number;

if (typeof installationId !== "number") {
throw new Error(
"installationId is required for installation authtentication."
Copy link
Contributor

@gr2m gr2m Aug 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in "authtentication" :)

I like to prefix error messages with the package names. And maybe clarify that installationId is an option? How about this

Suggested change
"installationId is required for installation authtentication."
"[@octokit/auth-app] installationId option is required for installation authentication."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops haha, fix a typo/leave a typo I guess! That looks pretty good to me, I'll update that and the test for it as well.

Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@gr2m gr2m changed the title Throw error on missing installationId fix: throw helpful error on auth({ type: "installation" }) if installationId option is not set Aug 2, 2020
@gr2m gr2m added the Type: Bug Something isn't working as documented, or is being fixed label Aug 2, 2020
@gr2m gr2m merged commit 7d05361 into octokit:master Aug 2, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2020

🎉 This PR is included in version 2.4.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented, or is being fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Throw helpful error is installationId is unset
2 participants