lambda-local
lambda-local copied to clipboard
lambda-local, when run with --wait-empty-event-loop, throws "No such module: timer_wrap"
Hi! Thank you for your work on the package. There seems to be an issue with the --wait-empty-event-loop
option that occurs on versions of Node.js 11 and greater. lambda-local
, when run with the --wait-empty-event-loop
option, throws an error:
Error: No such module: timer_wrap
at process.binding (node:internal/bootstrap/loaders:144:11)
at Object.waitForNodeJS ([redacted]/lambda-local/build/lib/utils.js:148:37)
My Node.js version is:
$ node -v
v16.4.2
This seems to be related to a similar issue in another package: https://github.com/myndzi/wtfnode/issues/32
Apparently timer_wrap
has been deprecated in Node.js 11, and async_hooks
must be used instead.
If anyone stumbles across this issue in the future, and the issue has not yet been addressed by that time, - then you may try the following dirty workaround:
- clone this repo
- go to
./src/lib/utils.ts
- scroll down to the definition of the
waitForNodeJs
function - replace the definition with:
export function waitForNodeJS(cb) {
setTimeout(cb, 1e3);
}
- build the project by running
npm build
, if any build errors pop up, they should be easy to address - run lambda-local from
./build/cli.js
Hmm thanks for the report. We'll need to update that function
Note to self: investigate how wtfnode does it (https://github.com/myndzi/wtfnode/blob/master/index.js). The API has been completly changed
Fixed in 2.0.3 ! sorry for the delay
@gpotter2 It's okay. Thank you!