Azure / azure-functions-microsoftgraph-extension

Microsoft Graph extension for Azure Functions
MIT License
46 stars 23 forks source link

Token binding contains hard coded path for token storage #76

Open baywet opened 5 years ago

baywet commented 5 years ago

Repro:

You'll get the following error message in the functions host console

System.Private.CoreLib: Exception has been thrown by the target of an invocation. System.IO.FileSystem: Could not find a part of the path 'D:\home\data\byob_graphmap'

Fortunately plugging a usb key and affecting the D letter works around the issue, but this is far from ideal.

ConnorMcMahon commented 5 years ago

This is actually configurable via the app setting BYOB_TokenMap. If you set it as a local app setting, you should be able to avoid this issue for local development without affecting the issue in production.

baywet commented 5 years ago

I forgot to mention I already have this set up in my local.settings.json, the path exists and I have rights to write to it.

{
"Values": {
"BYOB_TokenMap": "C:\\sources\\gitttl\\SiteCreation\\SiteCreation\\bin\\Debug\\Byob_tokenMap"
}
}
FlapKap commented 5 years ago

I can confirm this issue. My guess is that the null check in GraphOptions.cs is never true because the value is hardcoded. It never reads from appSettings.

ConnorMcMahon commented 5 years ago

Ah, this must have broken with the recent dependency injection changes. I'll open a PR for this.

baywet commented 5 years ago

@ConnorMcMahon checkout #77

richardu commented 5 years ago

Hi @ConnorMcMahon,

I'm unable to get this working, even with the latest source from GitHub (since this fix isn't in the 1.0.0.beta6 release) - the config value isn't read. Am I missing something?

Thx, Rich

baywet commented 5 years ago

@richardu have you tried from the dev branch? MY PR has only made it so far. https://github.com/Azure/azure-functions-microsoftgraph-extension/pull/77

richardu commented 5 years ago

Hi @ConnorMcMahon I grabbed the master branch since it's currently level with dev - I can see your fix here: https://github.com/Azure/azure-functions-microsoftgraph-extension/commit/ed2969d59440c19b5b588f55097a24de5d866725

Marina132000ae commented 5 years ago

Any updates on this?

trevonmckay commented 5 years ago

As a workaround to test locally I created a virtual drive using the following command

subst d: C:\Users\{username}\tmp

aymenv12 commented 4 years ago

Hi all,

I had the same issue and I resolved it as below.

If you developed your Azure Function locally and you got this error after publishing. Simply, you have to create a new partition D:\ on your local hard disk.

It worked for me.

vladkasianenko commented 4 years ago

I also have this problem. So no way to follow this guide.