Skip to content

AsyncResource.bind does not forward arguments #36051

Closed
@lroal

Description

@lroal

Using Node 12.19.0:
When binding a function with AsyncResource.bind, the arguments are not forwarded.
I had to write this workaround to make it work:

function bindWorkAround(cb) {
	AsyncResource.bind(invokeOriginal);
	let _arguments;
	return onData;

	function onData() {
		_arguments = arguments;
		invokeOriginal();
	}

	function invokeOriginal() {
		cb.apply(null, _arguments);
	}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    async_hooksIssues and PRs related to the async hooks subsystem.docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions