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.

DisableResponseDecompressionPolicy error with electron app using azure sdk from angular renderer

See original GitHub issue

I have a desktop app that uses electron and angular. I am trying to upload the Blob storage using @azure/storage-blob in the angular renderer process. When uploadData method is called library will just crash with following error:

Error: Uncaught (in promise): Error: DisableResponseDecompressionPolicy is not supported in browser environment
Error: DisableResponseDecompressionPolicy is not supported in browser environment

Please note I am using nodeIntegration: true when opening the angular portal like below:

     this.mainWindow = new BrowserWindow({
          webPreferences: {
            nodeIntegration: true
         },
        });

From my understanding is that disableResponseDecompressionPolicy is only available in Node.js but this is a common use case where angular apps running inside an electron shell need to communicate with azure-storage. Can we get more clarity on this issue, whether this is a limit in the SDK and how can angular app inside electron work

old issue: https://github.com/Azure/azure-sdk-for-js/issues/14025

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
EmmaZhucommented, Nov 4, 2022

@gingi :

I think the issue is because: The bundler dectects it’s a browserfy environment and choses the browser version DisableResponseCompressionPolicy definition when isNode() is not invoked yet. While in runtime, isNode() is invoked and returns true due to configure of nodeIntegration: true

1reaction
EmmaZhucommented, Apr 26, 2022

Hi @jeremymeng ,

I may understand the issue wrong, please correct me if I’m wrong.

The issue here is: when customer set nodeIntegration: true, isNode which detects the environment in runtime would return true, but the file is picked up in compiling and the compiler thinks it’s a browser.

I see we only support disableResponseDecompressionPolicy in Node.JS, because we have no control on whether to decompress response content in Browser environment.

If customer sets nodeIntegration: true, do we have control on on whether to decompress response content? If anyway, we cannot control it, I think maybe ignoring the disableResponseDecompressionPolicy setting with a warning is a good way to go.

Thanks Emma

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 11 Electron IPC communication 'send' of undefined
If you try to access them directly in your angular component, linter will give error because they are not defined on the standard...
Read more >
How to access Electron Api in my Angular Components?
I do not have a renderer.js file as I'm using Angular. ... src/app/electron.api"; I get the error "Uncaught Exception: main.ts:1 import ...
Read more >
How to create an Electron app using Angular and SQLite3.
This is a well documented issue. To get around this, we can use ThornstonHans' ngx-electron package, which wraps all the Electron API's exposed...
Read more >
Securing an Electron App Implemented With Angular Using ...
Understanding the problem ... We are using the code flow to authenticate our application against the Secure Token Server (STS). In a web ......
Read more >
Creating a Desktop App with Electron and Angular | Buddy
In this article, we'll learn how to build cross-platform desktop apps for Windows, Linux and macOS using Electron, TypeScript and Angular.
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