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.

Generate the rest API orders for debugging purpose when calling something from azure sdk

See original GitHub issue

Hi,

It could be really useful for debugging purpose to get the equivalent rest api calls that are made when we call something in azure SDK.

For example :

const postgresCli = new PostgreSQLManagementClient(azureCredential, subscriptionId);
const fwRules = postgresCli.firewallRules.listByServer(azResourceGroup, azPostgresServerName);

I’d like to have the rest api calls at runtime displayed in the logs,

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{azResourceGroup}/providers/Microsoft.Sql/servers/{azPostgresServerName}/firewallRules?api-version=2021-02-01-preview

Perhaps, there is already a way to do that, but I didn’t find it.

Regards, Blured.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
xirzeccommented, May 23, 2022

@maorleger @xirzec I think this should be investigated more as a feature request to the plaform - how does a customer identify auth issues when the code hasn’t changed between deployment environments? Clearly this customer understands at a base level it is the REST API. Can there be something smarter in logging or the platform to help resolve these issues?

We’ve been trying to go back and add better error messages / log statements for this reason (e.g. https://github.com/Azure/azure-sdk-for-js/blob/4bbe22736dcbe6c316dc6f628273e4f30fe022c2/sdk/identity/identity/src/credentials/clientCertificateCredential.ts#L121 )

When we figure out the cause here perhaps we can add something specific to this scenario that would speed up diagnosis next time. /cc @KarishmaGhiya

1reaction
qiaozhacommented, May 20, 2022

@blured75 Can you try to add the following way in your code. This should be able to log some information you needed

const logger = require('@azure/logger');
logger.setLogLevel('verbose');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug for azure sdk (How to show the relevant REST API)
I wanted to use the existing sdk calls and get the relevant created rest api calls displayed in logs. And then analyse the...
Read more >
Azure REST API reference documentation - Microsoft Learn
Reference documentation for Azure REST APIs including their supported operations, request URI parameters and request bodies, responses, ...
Read more >
Azure REST API Reference - Microsoft Learn
Welcome to the Azure REST API Reference. Representational State Transfer (REST) APIs are service endpoints that support sets of HTTP operations ...
Read more >
Debug APIs in Azure API Management using request tracing
Trace a call · Sign in to the Azure portal, and navigate to your API Management instance. · Select APIs. · Select Demo...
Read more >
Use Azure SDKs for JavaScript and TypeScript - Microsoft Learn
Want to make REST calls directly because you don't want the entire SDK to use a single REST API or you want deeper...
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