account-lookup-service 17.2.0 → 17.2.1-snapshot.0

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.
package/.ncurc.yaml CHANGED
@@ -1,5 +1,6 @@
1
1
  ## Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
2
2
  reject: [
3
3
  # TODO: v6+ (ref: https://github.com/sindresorhus/get-port/releases/tag/v6.0.0) is an ESM library and thus not compatible with CommonJS. Future story needed to resolve.
4
- "get-port"
4
+ "get-port",
5
+ "@mojaloop/inter-scheme-proxy-cache-lib" # remove it after merging snapshot
5
6
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "account-lookup-service",
3
3
  "description": "Account Lookup Service is used to validate Party and Participant lookups.",
4
- "version": "17.2.0",
4
+ "version": "17.2.1-snapshot.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -95,11 +95,11 @@
95
95
  "@mojaloop/central-services-health": "15.0.4",
96
96
  "@mojaloop/central-services-logger": "11.5.5",
97
97
  "@mojaloop/central-services-metrics": "12.4.5",
98
- "@mojaloop/central-services-shared": "18.19.0",
98
+ "@mojaloop/central-services-shared": "18.20.0",
99
99
  "@mojaloop/central-services-stream": "11.5.1",
100
100
  "@mojaloop/database-lib": "11.1.3",
101
101
  "@mojaloop/event-sdk": "14.1.5",
102
- "@mojaloop/inter-scheme-proxy-cache-lib": "2.3.3",
102
+ "@mojaloop/inter-scheme-proxy-cache-lib": "2.3.3-snapshot.0",
103
103
  "@mojaloop/ml-schema-transformer-lib": "2.5.4",
104
104
  "@mojaloop/sdk-standard-components": "19.7.0",
105
105
  "@now-ims/hapi-now-auth": "2.1.0",
@@ -30,6 +30,7 @@
30
30
  ******/
31
31
  'use strict'
32
32
 
33
+ const process = require('node:process')
33
34
  const { Command } = require('commander')
34
35
  const Package = require('../../package.json')
35
36
  const Server = require('../server')
@@ -37,6 +38,15 @@ const { HANDLER_TYPES } = require('../constants')
37
38
  const Config = require('../lib/config')
38
39
  const log = require('../lib').logger.child('ALS-timeout-handler')
39
40
 
41
+ process.on('uncaughtExceptionMonitor', (err) => {
42
+ log.error(`uncaughtException: ${err?.message}`, err)
43
+ process.exit(2)
44
+ })
45
+ process.on('unhandledRejection', (err) => {
46
+ log.error(`unhandledRejection: ${err?.message}`, err)
47
+ process.exit(3)
48
+ })
49
+
40
50
  const Program = new Command()
41
51
 
42
52
  Program
@@ -51,12 +61,12 @@ Program.command('handlers')
51
61
  const handlers = []
52
62
 
53
63
  if (args.timeout) {
54
- log.debug('CLI: Executing --timeout')
64
+ log.verbose('CLI: Executing --timeout')
55
65
  handlers.push(HANDLER_TYPES.TIMEOUT)
56
66
  }
57
67
 
58
68
  if (handlers.length === 0) {
59
- log.debug('CLI: No handlers specified')
69
+ log.info('CLI: No handlers specified')
60
70
  return
61
71
  }
62
72
 
@@ -17,8 +17,7 @@
17
17
  ******/
18
18
  const Hapi = require('@hapi/hapi')
19
19
  const Metrics = require('@mojaloop/central-services-metrics')
20
- const { plugin: HealthPlugin } = require('./plugins/health')
21
- const MetricsPlugin = require('@mojaloop/central-services-metrics').plugin
20
+ const healthPlugin = require('./plugins/health').plugin
22
21
  const { logger } = require('../../lib')
23
22
 
24
23
  let server
@@ -26,7 +25,7 @@ let server
26
25
  const create = async ({ port, metricsConfig }) => {
27
26
  Metrics.setup(metricsConfig)
28
27
  server = new Hapi.Server({ port })
29
- await server.register([HealthPlugin, MetricsPlugin])
28
+ await server.register([healthPlugin, Metrics.plugin])
30
29
  }
31
30
 
32
31
  const start = async ({ enabled, port, metricsConfig, proxyCache }) => {
@@ -39,7 +38,7 @@ const start = async ({ enabled, port, metricsConfig, proxyCache }) => {
39
38
 
40
39
  const stop = async () => {
41
40
  await Promise.all([
42
- server?.stop(),
41
+ server.stop(),
43
42
  server.app.proxyCache?.disconnect()
44
43
  ])
45
44
  server = null
@@ -20,8 +20,8 @@
20
20
 
21
21
  const { HealthCheck } = require('@mojaloop/central-services-shared').HealthCheck
22
22
  const { defaultHealthHandler } = require('@mojaloop/central-services-health')
23
- const packageJson = require('../../../../package.json')
24
23
  const { getProxyCacheHealth } = require('../../../lib/healthCheck/subServiceHealth')
24
+ const packageJson = require('../../../../package.json')
25
25
 
26
26
  let healthCheck
27
27
 
@@ -47,17 +47,18 @@ const Monitoring = require('./monitoring')
47
47
  const registerHandlers = async (handlers, options) => {
48
48
  const { logger } = options
49
49
  await init(options)
50
- handlers.forEach(handler => {
50
+
51
+ for (const handler of handlers) {
51
52
  switch (handler) {
52
53
  case HANDLER_TYPES.TIMEOUT:
53
54
  logger.debug('Registering Timeout Handler')
54
- TimeoutHandler.register(options)
55
+ await TimeoutHandler.register(options)
55
56
  break
56
57
  default:
57
58
  logger.warn(`Handler ${handler} not found`)
58
59
  break
59
60
  }
60
- })
61
+ }
61
62
  }
62
63
 
63
64
  /**
@@ -24,8 +24,7 @@
24
24
  'use strict'
25
25
 
26
26
  const { statusEnum, serviceName } = require('@mojaloop/central-services-shared').HealthCheck.HealthCheckEnums
27
- const Logger = require('@mojaloop/central-services-logger')
28
-
27
+ const { logger } = require('../../lib')
29
28
  const MigrationLockModel = require('../../models/misc/migrationLock')
30
29
 
31
30
  /**
@@ -45,7 +44,7 @@ const getSubServiceHealthDatastore = async () => {
45
44
  status = statusEnum.DOWN
46
45
  }
47
46
  } catch (err) {
48
- Logger.isDebugEnabled && Logger.debug(`getSubServiceHealthDatastore failed with error ${err.message}.`)
47
+ logger.warn(`error in getSubServiceHealthDatastore: ${err?.message}`, err)
49
48
  status = statusEnum.DOWN
50
49
  }
51
50
 
@@ -63,12 +62,12 @@ const getSubServiceHealthDatastore = async () => {
63
62
  * @returns Promise<SubServiceHealth> The SubService health object for the proxy cache
64
63
  */
65
64
  const getProxyCacheHealth = async (proxyCache) => {
66
- let status = statusEnum.OK
65
+ let status
67
66
 
68
67
  try {
69
68
  status = await proxyCache.healthCheck() ? statusEnum.OK : statusEnum.DOWN
70
69
  } catch (err) {
71
- Logger.isDebugEnabled && Logger.debug(`getProxyCacheHealth failed with error ${err.message}.`)
70
+ logger.warn(`error in getProxyCacheHealth: ${err?.message}`, err)
72
71
  status = statusEnum.DOWN
73
72
  }
74
73
 
package/src/server.js CHANGED
@@ -33,6 +33,7 @@ const { Endpoints, Participants, proxies, OpenapiBackend } = require('@mojaloop/
33
33
  const { createProxyCache } = require('@mojaloop/inter-scheme-proxy-cache-lib')
34
34
 
35
35
  const { name, version } = require('../package.json')
36
+ const { logger } = require('./lib')
36
37
  const Db = require('./lib/db')
37
38
  const Util = require('./lib/util')
38
39
  const Plugins = require('./plugins')
@@ -56,7 +57,8 @@ const createConnectedProxyCache = async (proxyCacheConfig) => {
56
57
  proxyCacheConfig.type,
57
58
  proxyCacheConfig.proxyConfig
58
59
  )
59
- await proxyCache.connect()
60
+ const connStatus = await proxyCache.connect()
61
+ logger.info('proxyCache connected', { connStatus, proxyCacheConfig })
60
62
  return proxyCache
61
63
  }
62
64
 
@@ -176,7 +178,7 @@ const initializeAdmin = async (appConfig) => {
176
178
 
177
179
  const initializeHandlers = async (handlers, appConfig, logger) => {
178
180
  const proxyCache = await createConnectedProxyCache(appConfig.PROXY_CACHE_CONFIG)
179
- const options = { proxyCache, batchSize: appConfig.HANDLERS_TIMEOUT_BATCH_SIZE, logger }
181
+ const options = { proxyCache, logger, batchSize: appConfig.HANDLERS_TIMEOUT_BATCH_SIZE }
180
182
  await Handlers.registerHandlers(handlers, options)
181
183
  }
182
184