@pbvision/fastify-firestore-service 0.0.41 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api/api.js +15 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pbvision/fastify-firestore-service",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "description": "Web Framework using Fastify and Firestore ORM",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/api/api.js CHANGED
@@ -413,7 +413,7 @@ class API {
413
413
  * used if these fields don't include sensitive information.
414
414
  */
415
415
  __trackInputsWithSentry () {
416
- const inputs = this.getInputsToTrackWithSentry()
416
+ const inputs = this.constructor.getInputsToTrackWithSentry(this.req)
417
417
  // istanbul ignore else
418
418
  if (inputs) {
419
419
  this.setSentryContext('inputs', inputs)
@@ -427,11 +427,11 @@ class API {
427
427
  * helpful debugging information but should only be
428
428
  * used if these fields don't include sensitive information.
429
429
  */
430
- getInputsToTrackWithSentry () {
430
+ static getInputsToTrackWithSentry (req) {
431
431
  return {
432
- ...this.req.query,
433
- ...this.req.params,
434
- ...this.req.body
432
+ ...req.query,
433
+ ...req.params,
434
+ ...req.body
435
435
  }
436
436
  }
437
437
 
@@ -797,7 +797,16 @@ class API {
797
797
  let ret
798
798
  try {
799
799
  if (req.validationError) {
800
- req.__sentry = { context: { validationError: req.validationError } }
800
+ req.__sentry = { context: {} }
801
+ const errCopy = { ...req.validationError }
802
+ errCopy.validation = JSON.stringify(errCopy.validation, null, 4)
803
+ req.__sentry.context.validationError = errCopy
804
+ try {
805
+ req.__sentry.context.inputs = this.getInputsToTrackWithSentry(req)
806
+ } catch (err) {
807
+ // istanbul ignore next
808
+ console.warn('trying to get inputs to track failed', err)
809
+ }
801
810
  throw new InvalidInputException(req.validationError)
802
811
  }
803
812
  ret = await this._callAndHandleRequestDone(reply, async () => {