-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Expected signal to be an instanceof AbortSignal #83
Comments
After further investigation on this topic I managed to find out that this problem comes from the production mode build. On local dev I build and run the app in development mode and everythings works fine. But of course for deployment I switch to production and then the type error is thrown. When build and running the app locally in production mode the same error is also thrown... |
Having the same issue with @netcoding87 were you able to work around this? |
Hey @kepikoi, unfortunately not with webpack... We switched to use typescript compiler only and there we do not have this issue anymore. |
I think I found the cause of this issue. Tldr is webpack does rewrite the constructor names in production mode and node-fetch 2.6 contains logic where it compares whether some constructor name is exactly This issue is documented in node-fetch/node-fetch#667 and was fixed in the 3.x branch which is currently in the pre-release stage. So, unless the maintainers of https://github.com/Azure/ms-rest-js are willing to upgrade node-fetch to an unstable release, it seems like we're stuck with this error for some time |
It is possible to disable the minimization of constructor names in webpack in production which will work around node-fetch/node-fetch#667
With this I was able to get a working production build again |
Hi all, thanks for documenting the fixes you made to work around the issue! I don't think we'll be able to update to a pre-release version of |
If you don't want to disable minimization at all, just use a regular expression to prevent minificaiton of the const TerserPlugin = require('terser-webpack-plugin')
const config = {
mode: 'development',
// your default config
}
module.exports = (env, argv) => {
if (argv.mode === 'production') {
config.mode = 'production'
config.devtool = 'source-map'
config.optimization = {
...(config.optimization || {}),
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
keep_fnames: /AbortSignal/,
},
}),
],
}
}
return config
} |
For anyone working with esbuild and encounter the same error, use the --keep-names flag. |
Package Version: "^3.0.3"
Describe the bug
I am deploying a backend node app (using typescript) inside a docker container (based on
node:12.13.1-alpine
). Inside this app I am trying to authenticate to azure vialoginWithServicePrincipalSecret
. But right now I am getting the following error:TypeError: Expected signal to be an instanceof AbortSignal
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect to be able to receive the auth response.
Additional context
I've already seen the issue #82 which is similar but adding
dom
and/ordom.iterable
to the tsconfig.json did not help. Here is what my tsconfig.json looks now:The text was updated successfully, but these errors were encountered: