-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
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: |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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
"installationId is required for installation authtentication." | |
"[@octokit/auth-app] installationId option is required for installation authentication." |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
auth({ type: "installation" })
if installationId
option is not set
🎉 This PR is included in version 2.4.11 🎉 The release is available on: Your semantic-release bot 📦🚀 |
An installationId is required in either
createAuthApp
orauth
when using the installation auth type. This adds an error message to warn users when an installationId is missing.Closes #64