lodestar
lodestar copied to clipboard
Inspect 'require' usage in lodestar
Describe the bug
After esm migration, we can not use require function any more, otherwise we'll get error like below:
Aug-05 11:12:05.423[API] ^[[31merror^[[39m: Req req-4b writeHeapdump error NodeJS only
Error: NodeJS only
at Object.writeHeapdump (file:///usr/src/lodestar/packages/beacon-node/src/api/impl/lodestar/index.ts:48:48)
at Object.handler (file:///usr/src/lodestar/packages/api/src/utils/server/genericJsonServer.ts:39:41)
at preHandlerCallback (/usr/src/lodestar/node_modules/fastify/lib/handleRequest.js:124:28)
at preValidationCallback (/usr/src/lodestar/node_modules/fastify/lib/handleRequest.js:107:5)
at handler (/usr/src/lodestar/node_modules/fastify/lib/handleRequest.js:70:7)
at handleRequest (/usr/src/lodestar/node_modules/fastify/lib/handleRequest.js:30:9)
at runPreParsing (/usr/src/lodestar/node_modules/fastify/lib/route.js:422:5)
at next (/usr/src/lodestar/node_modules/fastify/lib/hooks.js:158:7)
at handleResolve (/usr/src/lodestar/node_modules/fastify/lib/hooks.js:175:5)
Expected behavior
No error
Steps to Reproduce
curl -X POST http://localhost:9596/eth/v1/lodestar/writeheapdump