Skip to content

AsyncResource.bind does not forward arguments #36051

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);
	}

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    async_hooksIssues and PRs related to the async hooks subsystem.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions