question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use @azure/ms-rest-nodeauth loginWithServicePrincipalSecret for @azure/arm-sqlvirtualmachine

See original GitHub issue

Describe the bug A clear and concise description of what the bug is.

Repro Code:

import { loginWithServicePrincipalSecret } from "@azure/ms-rest-nodeauth";
import { SqlVirtualMachineManagementClient } from "@azure/arm-sqlvirtualmachine";

async function run() {
  const creds = await loginWithServicePrincipalSecret(
    "",
    "",
    ""
  );
  const client = new SqlVirtualMachineManagementClient(creds, "");
}
Argument of type 'ApplicationTokenCredentials' is not assignable to parameter of type 'ServiceClientCredentials'.
  Types of property 'signRequest' are incompatible.
    Type '(webResource: import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/ms-rest-js/es/lib/webResource").WebResource) => Promise<import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/ms-rest-js/es/lib/webResource").WebResource>' is not assignable to type '(webResource: import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/arm-sqlvirtualmachine/node_modules/@azure/ms-rest-js/es/lib/webResource").WebResource) => Promise<import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/arm-sqlvirtualmachine/node_modules/@azure/ms-rest-js/es/lib/webResource").WebResource>'.
      Types of parameters 'webResource' and 'webResource' are incompatible.
        Type 'import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/arm-sqlvirtualmachine/node_modules/@azure/ms-rest-js/es/lib/webResource").WebResource' is not assignable to type 'import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/ms-rest-js/es/lib/webResource").WebResource'.
          Types of property 'shouldDeserialize' are incompatible.
            Type 'boolean | ((response: import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/arm-sqlvirtualmachine/node_modules/@azure/ms-rest-js/es/lib/httpOperationResponse").HttpOperationResponse) => boolean)' is not assignable to type 'boolean | ((response: import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/ms-rest-js/es/lib/httpOperationResponse").HttpOperationResponse) => boolean)'.
              Type '(response: HttpOperationResponse) => boolean' is not assignable to type 'boolean | ((response: HttpOperationResponse) => boolean)'.
                Type '(response: import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/arm-sqlvirtualmachine/node_modules/@azure/ms-rest-js/es/lib/httpOperationResponse").HttpOperationResponse) => boolean' is not assignable to type '(response: import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/ms-rest-js/es/lib/httpOperationResponse").HttpOperationResponse) => boolean'.
                  Types of parameters 'response' and 'response' are incompatible.
                    Type 'import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/ms-rest-js/es/lib/httpOperationResponse").HttpOperationResponse' is not assignable to type 'import("/Users/hdavidzhu/azure-vm-test/node_modules/@azure/arm-sqlvirtualmachine/node_modules/@azure/ms-rest-js/es/lib/httpOperationResponse").HttpOperationResponse'.
                      The types of 'request.headers' are incompatible between these types.
                        Property '_headersMap' is missing in type 'HttpHeadersLike' but required in type 'HttpHeaders'.

To Reproduce Steps to reproduce the behavior:

  1. Install the above packages
  2. Try to use the creds in the client

Expected behavior A clear and concise description of what you expected to happen.

The client should accept the credentials.

Screenshots If applicable, add screenshots to help explain your problem.

image

Additional context Add any other context about the problem here.

From https://github.com/Azure/azure-sdk-for-js/issues/6368, it looks like @azure/arm-sqlvirtualmachine works with @azure/ms-rest-nodeauth@2, but I’m using v3 for all my other clients.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
qiaozhacommented, Sep 15, 2020

@ramya-rao-a Hi, I have a PR #11252 to fix this issue. Could you please help review it? Thanks

1reaction
ramya-rao-acommented, Sep 14, 2020

Thanks for reporting @hdavidzhu!

@qiaozha, Can we have the package re-generated using the latest v4 of the code generator to fix this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

azurerm_mssql_virtual_machine | hashicorp/azurerm
This example provisions a brief Managed Microsoft SQL Virtual Machine. The detailed example of the azurerm_mssql_virtual_machine resource can be found in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found