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

Changes to get staging environment working #166

Closed mpsenn closed 1 year ago

mpsenn commented 1 year ago

Fixes #165. While setting up the staging environment, I made these changes. Some are strictly necessary, like the namespace prefixing on fields. Some helped me find those issues, like returning errors from event handlers and logging more details in createWorkItem.

Medium changes

(connection.js and services/Gus/*) Keep GUS api sessions alive for 10 minutes. And add debug logging for SOQL requests

(connection.js) Implement namespace prefixes on objects and fields. This should have been implemented when the app started supporting Agile Accelerator, which always has a namespace; not sure why this wasn't done already.

(GithubEvents/index.js and ghEvents.js) Wait for event handlers to return before returning from the github webhook. Previously webhooks would return synchronously, before any GUS callouts would be processed. Now, GUS callouts will delay the webhook response and can affect the 2xx/5xx status code. This will help track errors and latency through logs.

Small changes

Add missing peer dependency 'winston'

Add logs in createWorkItem that helped diagnose an issue with bug priorities.

(GithubEvents/index.js) Use captureRejectionSymbol to mitigate an unhandled promise rejection and avoid app crash. Related to #161.

mpsenn commented 1 year ago

Could probably write some more tests for these changes, but I think its ready for review.

mpsenn commented 1 year ago

I did push up e516404 that passes unit tests, but didn't test it on the staging environment yet. I'll do that once I get time, as well as writing an internal doc so our folks can use the environment. A draft of that is in our internal slack channel.