Skip to content

AsyncResource.bind does not forward argumentsΒ #36051

@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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions