Azure-sdk-for-js: Client Side Authentication Issue

Created on 18 Jun 2020  路  12Comments  路  Source: Azure/azure-sdk-for-js

@jasongaylord commented on Wed Jun 17 2020

It seems as though something has changed in the AppConfigCredential.signRequest method. Here's what I have:

  • The NPM package @azure/app-configuration version 1.0.1
  • Using TypeScript
  • Connecting using const client = new AppConfigurationClient('<connection string>');

In the logs, I'm seeing the following:

core.js:6228 ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at AppConfigCredential.signRequest (appConfigCredential.js:23)
    at SigningPolicy.push../node_modules/@azure/core-http/es/src/policies/signingPolicy.js.SigningPolicy.signRequest (signingPolicy.js:20)
    at SigningPolicy.push../node_modules/@azure/core-http/es/src/policies/signingPolicy.js.SigningPolicy.sendRequest (signingPolicy.js:24)
    at GenerateClientRequestIdPolicy.push../node_modules/@azure/core-http/es/src/policies/generateClientRequestIdPolicy.js.GenerateClientRequestIdPolicy.sendRequest (generateClientRequestIdPolicy.js:24)
App Configuration Client customer-reported question

All 12 comments

Thanks for moving it here @zhenlan

Thank you for notifying us. I'll be looking at this.

Thank you for notifying us. I'll be looking at this.

If you'd like me to test out a fix, let me know. I have a prototype ready to go.

Hi @jasongaylord, I'm not able to reproduce this (at least, not with my out-of-the-box sample).

Do you mind sharing a small sample app that demonstrates this problem? I'm wondering if I'm missing a combination of dependencies.

I've uploaded my sample app to see if it helps us narrow things down:
https://github.com/richardpark-msft/samples/tree/master/9585

https://github.com/jasongaylord/AngularAzureFeatureFlag/tree/Complete/src/app

Really, the showAboutMeFeature.ts file is where I planned on doing most of the work. It's used in the main component.

@richardpark-msft Not sure if you noticed my post above ^^^

@jasongaylord - just an update - I believe I found a fix for this. Your sample app was a HUGE help, thank you for posting it.

The crux of the issue is that AppConfig uses the node crypto package. The error you've got above is because we're attempting to call createHash which is coming back undefined (crypto is being stubbed out).

I've got a tentative fix in PR #9648 where we use the WebCrypto APIs when in the browser. Some of the critical reviewers are out of office at the moment so there will be a delay but I will keep you updated as it moves through.

@richardpark-msft Thanks for your assistance. I saw that one of the reviewers have responded to PR #9648 . In case others run into this, I blogged about it at https://jasong.us/3ev93nQ. I'll update my post once the fix is merged and GA.

@jasongaylord - happy Friday :)

The PR has been approved and we a have a nightly build available with the fix you'd like to try it early:
https://www.npmjs.com/package/@azure/app-configuration/v/1.1.0-dev.20200625.2

The GA fix will be released with our normal monthly cadence (the first week of each month).

Thank you for reporting this issue - really appreciated working with you.

@jasongaylord - azure/app-configuration 1.1.0 has been released!

https://github.com/Azure/azure-sdk-for-js/releases/tag/%40azure%2Fapp-configuration_1.1.0

Lol. I have to update my Thursday blog post and remove the mention of using the dev release.

@richardpark-msft thanks for the quick turnaround!

Was this page helpful?
0 / 5 - 0 ratings