microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
964 stars 309 forks source link

[BUG] Cannot read property 'globalProvider' of undefined #651

Closed metahumantobe closed 4 years ago

metahumantobe commented 4 years ago

Earlier while defining global provider following code is used:

let provider = mgt.Providers.globalProvider;

But now mgt.Providers is undefined because of which globalProvider is throwing error and not able to search for the people in mgt-people-picker. I'm using SimpleProvider to create as global provider.

ghost commented 4 years ago

Hello metahumantobe, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

shweaver-MSFT commented 4 years ago

@metahumantobe, thanks for submitting this. I know exactly what the issue is! Yesterday we released out next preview, 2.0.0-preview.1.

It looks like you are using the hosted version via unpkg, which is always updated to the latest release. This means you are now pulling down our preview version. There are some breaking changes in V2, which is probably why you are seeing errors: <script src="https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js

To workaround, update your link to pull the latest production release version: <script src="https://unpkg.com/@microsoft/mgt@1.3.4/dist/bundle/mgt-loader.js"></script>

Alternatively, you can also use npm to download the package with the required version listed in the package.json. npm i @microsoft/mgt@1.3.4

metahumantobe commented 4 years ago

Thank you very much. Referring to latest production release version helped to resolve the issue.

HiltonGiesenow commented 4 years ago

I've hit this too, and the same fix worked (thanks). Any guidance on how to deal with this in V2?

nmetulev commented 4 years ago

This is a bug in V2.0 and should be fixed before release. Reopening issue for tracking

shweaver-MSFT commented 4 years ago

This issue speaks a lot to the complications of moving the Providers construct to the mgt-element package. It really forces the default workflow of using mgt to require references to the mgt-element package as well.

shweaver-MSFT commented 4 years ago

@HiltonGiesenow, I don't have any guidance for you quite yet. This package split is a newer thing for us, so it's got some kinks we are thinking through.

jeffwilcox commented 4 years ago

Interested to follow this conversation, too. My team is excited to try and use the newer react components... if we jump back to the 1.3.x world, how much pain are we signing up?

(Let me know how I can help, our app is auth'd for the various graph APIs in the Microsoft tenant and our goal is to use the ProxyProvider with our prod internal app)

metahumantobe commented 4 years ago

@shweaver-MSFT Hi, Thank you for the resolution. As you mentioned to download the packages using command npm i @microsoft/mgt@1.3.4 but I'm unable to download the packages and getting the error C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/microsoftgraph/msgraph-typescript-typings.git everytime. Can you please help regarding this issue in downloading npm package ?

nmetulev commented 4 years ago

@jeffwilcox, our goals is to not cause major breaking changes for the end user with 2.x. Would love to hear any feedback you have on the react wrappers - I'm happy to help if you are running into any issues or if you have any questions.

nmetulev commented 4 years ago

@metahumantobe, do you have git installed on your machine? If not, installing git should solve the issue.

jeffwilcox commented 4 years ago

Thanks for the comments @nmetulev. The wrapper and element package actually ended up working just fine!

Unfortunately I think we're just not going to be able to use this because of the admin consent rules around these people endpoints, etc. We've been asked to justify why these are "critical to the function of the app", and really, it's just a value-add for us to get access to user photos, show the people they work with often, in the People Picker. :(

We have all the basic graph APIs we need for our app already, just not the ones that make this some of these toolkit features more functional.