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

Improve error message when privateKey is not a single line String #311

Closed
oscard0m opened this issue Aug 1, 2021 · 2 comments · Fixed by #312
Closed

Improve error message when privateKey is not a single line String #311

oscard0m opened this issue Aug 1, 2021 · 2 comments · Fixed by #312
Assignees
Labels
Type: Feature New feature or request

Comments

@oscard0m
Copy link
Member

oscard0m commented Aug 1, 2021

Context: 40:09 in Reusing GitHub Apps and Actions with Gregor Martynus


I can take it once we agree on how to tackle this :)

@oscard0m oscard0m self-assigned this Aug 1, 2021
@gr2m
Copy link
Contributor

gr2m commented Aug 1, 2021

Thanks for filing the issue! I think the right place to add better errors would be here:

const appAuthentication = await githubAppJwt({
id: +appId,
privateKey,
now: timeDifference && Math.floor(Date.now() / 1000) + timeDifference,
});

We could wrap the code into a try/catch and in case of an error check if privateKey is only the first line of the private key, which is

-----BEGIN RSA PRIVATE KEY-----

And if it is, throw an error with a more helpful error message?

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2021

🎉 This issue has been resolved in version 3.6.0 🎉

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: Feature New feature or request
Projects
None yet
2 participants