Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
1.98k stars 1.15k forks source link

[@azure/storage-file-datalake] ERR_INVALID_URL when behind corporate proxy #30304

Closed thushanperera95 closed 1 day ago

thushanperera95 commented 1 week ago

Describe the bug I am getting the following error when trying to call DataLakeFileSystemClient.listPaths() with proxy options configured on the DataLakeServiceClient.

Exception: Invalid URL
Stack: TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:399:5)
    at URL.onParseError (node:internal/url:566:9)
    at new URL (node:internal/url:646:5)
    at Sanitizer.sanitizeUrl (C:\Dev\andii-devops\Solution\WebApp\AndiiAPI\FunctionAppAndiiAPI\node_modules\@azure\core-rest-pipeline\dist\commonjs\util\sanitizer.js:130:21)
    at IncomingMessage.<anonymous> (C:\Dev\andii-devops\Solution\WebApp\AndiiAPI\FunctionAppAndiiAPI\node_modules\@azure\core-rest-pipeline\dist\commonjs\util\sanitizer.js:72:29)
    at JSON.stringify (<anonymous>)
    at Sanitizer.sanitize (C:\Dev\andii-devops\Solution\WebApp\AndiiAPI\FunctionAppAndiiAPI\node_modules\@azure\core-rest-pipeline\dist\commonjs\util\sanitizer.js:63:21)    at [nodejs.util.inspect.custom] (C:\Dev\andii-devops\Solution\WebApp\AndiiAPI\FunctionAppAndiiAPI\node_modules\@azure\core-rest-pipeline\dist\commonjs\restError.js:27:64)
    at formatValue (node:internal/util/inspect:806:19)
    at inspect (node:internal/util/inspect:365:10).

To Reproduce Steps to reproduce the behavior:

  1. I have configured OnBehalfOfCredential and DataLakeServiceClient with proxyOptions as follows.

    const proxyOptions = {
    host: `http://${settings.PROXY_HOST}`,
    port: settings.PROXY_PORT,
    }
    
    const credentials = new OnBehalfOfCredential({
    tenantId: settings.AD_TENANT_ID,
    clientId: settings.AD_CLIENT_ID,
    clientSecret: settings.AD_CLIENT_SECRET,
    userAssertionToken: userAccessToken,
    proxyOptions,
    });
    
    const client = new DataLakeServiceClient(
    `https://${storageAccountName}.dfs.core.windows.net`,
    credentials,
    { proxyOptions }
    );
  2. Get the file system client with const fileSystemClient = serviceClient.getFileSystemClient(containerName);.
  3. Get list of paths and iterate through each path.
    for await (const path of fileSystemClient.listPaths()) {
    // process each path
    }

Expected behavior I expect listPaths to return the list of paths in the container without any exceptions.

Additional context

github-actions[bot] commented 1 week ago

@deyaaeldeen @jeremymeng @joheredi @maorleger @mpodwysocki @timovv @xirzec

github-actions[bot] commented 1 week ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jeremymeng commented 6 days ago

Likely would be addressed by PR #30151

jeremymeng commented 1 day ago

We just released a fix in @azure/core-rest-pipeline 1.16.2. Please refresh your dependencies to get the latest version.