forcedotcom / git2gus

A Github application to keep issues in sync with Agile Accelerator
https://lwc-gus-bot.herokuapp.com
BSD 3-Clause "New" or "Revised" License
27 stars 16 forks source link

App crash due to unhandled promise rejection in Gus.getWorkItemIdByName #161

Open mpsenn opened 1 year ago

mpsenn commented 1 year ago

This TypeError is unhandled, causes a promise to reject, and crashes the app. This function looks like it doesn't really understand Promises either, since it mixes callback functions and async/await.

Wishlist:

  1. Fix the app crash.
  2. Refactor this class to correctly use Promises.
  3. Install a global unhandledpromiserejection logger? Not sure if we want these to lead to app crashes, or just error logs.
TypeError: Cannot read properties of undefined (reading 'Id')
    at /app/api/services/Gus/getWorkItemIdByName.js:29:31
    at promiseCallback (/app/node_modules/jsforce/lib/query.js:337:15)
    at module.exports.<anonymous> (/app/node_modules/jsforce/lib/query.js:350:5)
    at Object.onceWrapper (node:events:510:26)
    at module.exports.emit (node:events:390:28)
    at module.exports.<anonymous> (/app/node_modules/jsforce/lib/query.js:369:14)
    at Object.onceWrapper (node:events:509:28)
    at module.exports.emit (node:events:390:28)
    at endReadableNT (/app/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)