commands icon indicating copy to clipboard operation
commands copied to clipboard

Probot Crashes if PR Description Body is Empty

Open matthewdfuller opened this issue 2 years ago • 0 comments

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:

  1. 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);
};
  1. Go to GitHub (on a repo where the app is installed) and open a new pull request.
  2. Leave the PR description empty.
  3. Submit the PR
  4. 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

matthewdfuller avatar Feb 04 '23 16:02 matthewdfuller