Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods .getStream and .putStream don't support Promises #110

Closed
jmorino opened this issue Sep 10, 2018 · 3 comments
Closed

Methods .getStream and .putStream don't support Promises #110

jmorino opened this issue Sep 10, 2018 · 3 comments
Labels

Comments

@jmorino
Copy link

jmorino commented Sep 10, 2018

When trying to use the "Promise" syntax of the .getStream method (ie. with no callback),

client.api(url).getStream()
	.then(stream => {
		// do something with stream
	})
	.catch(err => {
		// do domething with err
	})

I get the following error:

TypeError: Cannot read property 'then' of undefined

Nevertheless, the"callback" syntax works great:

return new Promise((resolve, reject) => {
	client.api(url).getStream((err, stream) => {
		if (err) {
			// do domething with err
		}
		else {
			// do something with stream
		}
	});
});
@jmorino
Copy link
Author

jmorino commented Sep 10, 2018

The same goes for the .putStream method:

client.api(url).putStream(buffer)
    .then(response => {
        // do something with response
    })

gives the following error:

TypeError: callback is not a function
    at Function.ResponseHandler.init (/.../node_modules/@microsoft/microsoft-graph-client/src/ResponseHandler.ts:6:13)
    at /.../node_modules/@microsoft/microsoft-graph-client/src/GraphRequest.ts:291:33
    at process._tickCallback (internal/process/next_tick.js:68:7)

@jmorino jmorino changed the title Method .getStream doesn't support Promises Methods .getStream and .putStream doesn't support Promises Sep 10, 2018
@jmorino jmorino changed the title Methods .getStream and .putStream doesn't support Promises Methods .getStream and .putStream don't support Promises Sep 10, 2018
@muthurathinam
Copy link
Contributor

muthurathinam commented Sep 10, 2018

This is done in this pull request and will be available in our next release.

876748

@muthurathinam
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants