-
Notifications
You must be signed in to change notification settings - Fork 36
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
Use the new probot package @probot/get-private-key #52
Use the new probot package @probot/get-private-key #52
Conversation
Prior to this change, errors would occur when trying to access the old helper file. Probot no longer includes this helper file. This change adds the new package to make it compatible with the latest version of probot.
@@ -11,7 +11,7 @@ const loadProbot = (appFn) => { | |||
new Probot({ | |||
id: process.env.APP_ID, | |||
secret: process.env.WEBHOOK_SECRET, | |||
privateKey: findPrivateKey(), | |||
privateKey: getPrivateKey(), |
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.
how would you usually configure the private key on lambda? I assume you wouldn't upload a *.pem
file, so the only option really is to define the PRIVATE_KEY
option? I think I'd remove the getPrivateKey
method altogether and instead set
privateKey: getPrivateKey(), | |
privateKey: process.env.PRIVATE_KEY, |
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.
Given that getPrivateKey()
does return process.env.PRIVATE_KEY
as one of it's options and in the README there is a bit about using a .pem
, I figured it would be safer to use this new package. But you're right, whenever I use lambda with serverless, I use the serverless-dotenv-plugin
with .env
files (also added this to the README).
I can't say for a fact it is impossible to use a *.pem
so I thought this would give a bit of flexibility. As things stand, this package is unusable with the latest @probot
which is the reason for this PR.
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.
As things stand, this package is unusable with the latest
@probot
which is the reason for this PR.
I agree, let's merge this PR and make a follow up PR for further discussion
I can confirm that missing {
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'probot/lib/helpers/get-private-key'\nRequire stack:\n- /var/task/node_modules/@probot/serverless-lambda/index.js\n- /var/task/bin/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'probot/lib/helpers/get-private-key'",
"Require stack:",
"- /var/task/node_modules/@probot/serverless-lambda/index.js",
"- /var/task/bin/index.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1015:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)",
" at Module.load (internal/modules/cjs/loader.js:879:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:724:14)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
" at internal/main/run_main_module.js:17:47"
]
} |
🎉 This PR is included in version 1.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Prior to this change, errors would occur when trying to access the old helper file. Probot no longer includes this helper file.
This change adds the new package to make it compatible with the latest version of Probot.
Also updates README with more information on setting this up with environment variables.
View rendered README.md