zarak
zarak

Reputation: 3003

Error when making API call to MS Graph via botbuilder-js SDK

I wrote a partial TypeScript version of the msgraph sample code from the botbuilder samples repo.

I followed the instructions to do the configuration on Azure here. I used version 2.0 of the Azure AD endpoint.

I used a common tenant and was successfully able to log-in via the bot, but when I try to make a graph API call using getMe (by sending the message 'me' to the bot),

    async getMe(): Promise<User> {
        return await this.graphClient
            .api('/me')
            .get().then((res) => {
                return res;
            });
    }

I receive an error:

GraphError {
  statusCode: -1,
  code: null,
  message: null,
  requestId: null,
  date: 2019-05-13T06:21:12.721Z,
  body: null }

I expect that this would successfully return the following message by getting the displayName field from the graph API call,

You are ${ me.displayName } and you report to nobody.

Upvotes: 0

Views: 164

Answers (1)

Steven Kanberg
Steven Kanberg

Reputation: 6368

Downgrade the @microsoft/microsoft-graph-client to specifically version 1.0.0 in your package.json. There is a bug that is present is all subsequent versions of that package that has yet to be corrected.

For clarity's sake, there are a couple later versions that do appear to correct this issue however other bugs then appear. The only working one, in my experience, has been the original version.

Upvotes: 1

Related Questions