azure-sdk-for-js icon indicating copy to clipboard operation
azure-sdk-for-js copied to clipboard

Error: proxyPolicy is not supported in browser environment - Electron App

Open ani-mal opened this issue 4 months ago • 8 comments

  • Package Name: @azure/[email protected] that has a dependency on @azure-rest/core-client": "^1.1.0 and @azure/core-rest-pipeline": "^1.8.0,

Describe the bug Unable to make a rest API call on the renderer on the ElectronApp because I get the following error: Error: proxyPolicy is not supported in browser environment. nodeIntegration is set to true and we can't turn this off.

the workaround for this is to run the API request on the main thread, but I would like to remove this workaround and have it all run in the renderer process.

To Reproduce Steps to reproduce the behavior:

  1. Install azure/[email protected] to an electron app that has nodeIntegration set to true
  2. Make a rest api call to ai translation
  3. See error coming from @azure/core-rest-pipeline that is the dependency tree of @azure/rest-ai-translation

Expected behavior Able to make a rest api request from the renderer process without getting Error: proxyPolicy is not supported in browser environment error.

Screenshots Image

Additional context Unable to provider the source code as it is not open sourced.

ani-mal avatar Oct 21 '24 10:10 ani-mal