msgraph-sdk-javascript: beta api is not working with 1.5.2
Bug Report
beta api is not working with 1.5.2 release but is with 1.4.0
Prerequisites
- Can you reproduce the problem?
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
Description
beta api is not working with 1.5.2 release but is with 1.4.0
Console Errors:
There is no error, it’s like there is an exception that has been swallowed.
Steps to Reproduce
With npm package 1.4.0 & 1.5.2: Running this code on v1.0 works fine
var AuthenticationContext = require('adal-node').AuthenticationContext;
var MicrosoftGraph = require("@microsoft/microsoft-graph-client");
require("isomorphic-fetch");
var client = MicrosoftGraph.Client.init({
//defaultVersion: 'beta',
authProvider: function (done) {
done(null, 'mytoken');
}
});
client
.api('/users')
.version('v1.0')
.get()
.then(function (res) {
console.log(res);
})["catch"](function (err) {
console.log(err);
});
With npm package 1.4.0: Running this code on beta works: With npm package 1.5.2: Running this code on beta doesn’t work:
var AuthenticationContext = require('adal-node').AuthenticationContext;
var MicrosoftGraph = require("@microsoft/microsoft-graph-client");
require("isomorphic-fetch");
var client = MicrosoftGraph.Client.init({
//defaultVersion: 'beta',
authProvider: function (done) {
done(null, 'mytoken');
}
});
client
.api('/applications')
.version('beta')
.get()
.then(function (res) {
console.log(res);
})["catch"](function (err) {
console.log(err);
});
Expected behavior: It outputs the application list
Actual behavior: Nothing at all, no application, no error.
Additional context
Calling, the beta api with postman or pure javascript works.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 30 (15 by maintainers)
Ok, adding isomorphic-fetch to my script is fine.
With 2.0.0-Preview.1 and 2.0.0-Preview.2 my script is working fine!
Thanks
@juchom It is expected error to remind that one has to include polyfill for fetch. Since there are some breaking changes in 2.0.0-Preview.x. Please follow this migration guide
In your first example that targets /user, does it work on both v1.0 and beta?
In the second example that is not working with beta when using 1.5.2, can you share the error that you see?