Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of the crash handler with serverless #57

Open
GeoffThorpeFT opened this issue Oct 6, 2023 · 0 comments
Open

Compatibility of the crash handler with serverless #57

GeoffThorpeFT opened this issue Oct 6, 2023 · 0 comments

Comments

@GeoffThorpeFT
Copy link

When we moved to node 18 we used the example to apply very similar code to a collection of our serverless apps.
However, one of those apps - the Problem Hub API - is now logging compatibility errors to splunk.

For example:

app: { [[-]](https://financialtimes.splunkcloud.com/en-GB/app/search/search?q=search%20index%3Daws_cloudwatch%20source%3D%2Faws%2Flambda%2Fproblem-hub-api*%20level%3Derror%20%20event%3DHANDLED_ERROR&earliest=1696575600.000&latest=1696577400&sid=1696602769.846655&display.page.search.mode=verbose&dispatch.sample_ratio=1&workload_pool=standard_perf#)
     commit: null
     name: problem-hub-api
     nodeVersion: 18.17.1
     processType: problem-hub-api-prod-deleteMessage
     region: eu-west-1
     releaseDate: null
   }
   error: { [[-]](https://financialtimes.splunkcloud.com/en-GB/app/search/search?q=search%20index%3Daws_cloudwatch%20source%3D%2Faws%2Flambda%2Fproblem-hub-api*%20level%3Derror%20%20event%3DHANDLED_ERROR&earliest=1696575600.000&latest=1696577400&sid=1696602769.846655&display.page.search.mode=verbose&dispatch.sample_ratio=1&workload_pool=standard_perf#)
     cause: null
     code: CRASH_HANDLER_NOT_REGISTERED
     data: { [[-]](https://financialtimes.splunkcloud.com/en-GB/app/search/search?q=search%20index%3Daws_cloudwatch%20source%3D%2Faws%2Flambda%2Fproblem-hub-api*%20level%3Derror%20%20event%3DHANDLED_ERROR&earliest=1696575600.000&latest=1696577400&sid=1696602769.846655&display.page.search.mode=verbose&dispatch.sample_ratio=1&workload_pool=standard_perf#)
     }
     isOperational: false
     message: Crash Handler cannot be used alongside other uncaughtException or unhandledRejection handlers
     name: Error
     relatesToSystems: [ [[-]](https://financialtimes.splunkcloud.com/en-GB/app/search/search?q=search%20index%3Daws_cloudwatch%20source%3D%2Faws%2Flambda%2Fproblem-hub-api*%20level%3Derror%20%20event%3DHANDLED_ERROR&earliest=1696575600.000&latest=1696577400&sid=1696602769.846655&display.page.search.mode=verbose&dispatch.sample_ratio=1&workload_pool=standard_perf#)
     ]
     stack: Error: Crash Handler cannot be used alongside other uncaughtException or unhandledRejection handlers
    at registerCrashHandler (/var/task/node_modules/@dotcom-reliability-kit/crash-handler/lib/index.js:35:5)
    at Object.<anonymous> (/var/task/src/handlers/deleteMessage.js:13:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at _tryRequireFile (file:///var/runtime/index.mjs:976:37)
    at _tryRequire (file:///var/runtime/index.mjs:1026:25)
     statusCode: null
   }
   event: HANDLED_ERROR
   level: error
   message: Error: Crash Handler cannot be used alongside other uncaughtException or unhandledRejection handlers
   time: 1696577091181
}

Here is the PR we used to require and register the crashHandler across all the handlers in the app: https://github.com/Financial-Times/problem-hub-api/pull/329/files#diff-27e55b3729e43add040290800f8a23b3cfe1838eab31f9c23dc831a391c516ee

Any ideas what we may have done wrong?

It is because the app has many handlers?
Should we register inside each serverless handler instead just outside?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant