Fix institution metrics sendAll cron (#19127)

* Don't send status 200 in the beginning: we may throw later

This was causing `Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client`
https://cloudlogging.app.goo.gl/Bchegw2iCYLxhPNk8

* Continue when failing to send one email, but log the error

* Revert "Don't send status 200...", log error instead

This reverts commit 3e13559704f822e330a18a68567f46491649f222.

* Fix `logger.error` params

* Fixup: good syntax for `logger.error`

* Remove useless `OError` import

* Update services/web/modules/metrics/app/src/MetricsEmailController.js

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Update services/web/modules/metrics/app/src/MetricsEmailController.js

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Update services/web/modules/metrics/app/src/MetricsEmailController.js

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Update services/web/scripts/recurly/collect_paypal_past_due_invoice.js

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: c68bc677326729fc6c39b7c2f027e35ebb776bd2
This commit is contained in:
Antoine Clausse 2024-06-26 09:06:00 +02:00 committed by Copybot
parent fc34b41b5b
commit de959fb7b9

View file

@ -123,7 +123,7 @@ if (require.main === module) {
process.exit(0)
})
.catch(err => {
logger.error('Error', err)
logger.error({ err }, 'Error')
process.exit(1)
})
}