Azure-sdk-for-js: Electron app error: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.

Created on 16 Sep 2019  路  14Comments  路  Source: Azure/azure-sdk-for-js

issue appears in electron render process, because '@azure/core-http' use global variable for fetch() and it's replaced. Window(global object for electron) has 'fetch' as well. Possible fix for file https://github.com/Azure/azure-sdk-for-js/blob/d211c97fdaa96ff4f1146029ac178b5666cb1678/sdk/core/core-http/lib/nodeFetchHttpClient.ts#L7
const fetch = require("node-fetch");

Azure.Core Client bug customer-reported

All 14 comments

Hi @daviwil , this is an issue regarding core-http library. Could you take a look? Thanks

I have tested various electron app configurations running the sdk in both render and main process. However, I was using a bundler, which ensured the code I ran in the main process was bundled for node, and code running in the render process was bundled for web. Thus, the render process code would never try to use node-fetch.

@gamaya-developer if you're still around, it might be helpful to say more about how you're building your app, and whether bundling is an option for you. It's also possible things have gotten better in the meantime!

Hi @bterlson! I think the main reason of issue is approach to use node.js in angular services. You can check boilerplate https://github.com/maximegris/angular-electron, the file where is the conditional import is https://github.com/maximegris/angular-electron/blob/master/src/app/core/services/electron/electron.service.ts.

In my case I have to import azure package inside conditional import to use node.js only available features for blob.
In my case I overcame the issue to import node-fetch before azure package.

@gamaya-developer Sorry for the slow reply, but are you happy with your workaround for now?

@daviwil @bterlson perhaps we should consider not using the global ref for fetch and use the import value, since this codepath is node-only anyway? The docs seem to indicate this may be a good idea: https://www.npmjs.com/package/node-fetch#loading-and-configuring-the-module

I think in any case we should not be relying on global mutation, so I support import fetch from 'node-fetch'.

Is there a temporary workaround for this issue? I'm running into this while using nwjs as well (https://github.com/nwjs/nw.js)

@jssuttles do you have a repro for this that we can try with the fix in #9880 ?

@jssuttles thank you!

@jeremymeng can you verify your PR against this?

Thanks @jssuttles for the repro. I am on it.

Yup, the issue is fixed by #9880

image

Should this come out of the backlog and into a milestone? When are we targeting a release of this change?

We are planing to include a fix in the next release of core-http.

August 2020 release that is.

Was this page helpful?
0 / 5 - 0 ratings