commands
commands copied to clipboard
Probot Crashes if PR Description Body is Empty
Probot, with the probot-commands extension installed, will crash if a PR is opened and the description is empty (set to null
in the GitHub event).
Steps to reproduce:
- Configure probot-commands:
const probotCommands = require('probot-commands');
const handler = require('path/to/handler');
module.exports = (app) => {
// Listen to slash commands
// ['issue_comment.created', 'issues.opened', 'pull_request.opened']
probotCommands(app, 'mycommand', handler);
};
- Go to GitHub (on a repo where the app is installed) and open a new pull request.
- Leave the PR description empty.
- Submit the PR
- Probot crashes with a 500 error:
INFO (http): POST / 500 - 3745ms
err: {
"type": "Error",
"message": "failed with status code 500",
"stack":
Error: failed with status code 500
at ServerResponse.onResFinished (/myapp/node_modules/pino-http/logger.js:77:38)
at ServerResponse.emit (node:events:525:35)
at ServerResponse.emit (node:domain:489:12)
at onFinish (node:_http_outgoing:950:10)
at callback (node:internal/streams/writable:555:21)
at afterWrite (node:internal/streams/writable:500:5)
at afterWriteTick (node:internal/streams/writable:487:10)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
}
ERROR (server): Internal Server Error
Error: Internal Server Error
at Request.callback (/myapp/node_modules/superagent/lib/node/index.js:921:17)
at IncomingMessage.<anonymous> (/myapp/node_modules/superagent/lib/node/index.js:1165:20)
at IncomingMessage.emit (node:events:525:35)
at IncomingMessage.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
status: 500