I've been using autorest for months to update my webapi client .NET Standard library that I use in my Xamarin app. I hadn't made an change in a while but did today. So I updated my swagger.json and re-ran my script. This time the script gave me the following error in its output:
AutoRest code generation utility [version: 2.0.4283; node: v12.1.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core 'C:\Users\Mark.autorest\@[email protected]\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4371)
Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.82)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
(node:47120) UnhandledPromiseRejectionWarning: TypeError: volume[member].bind is not a function
at patchFilesystem (C:\Program Files\nodejs\node_modules\autorest\dist\static-loader.js:277:43)
at C:\Program Files\nodejs\node_modules\autorest\dist\static-loader.js:281:18
at Object.global.staticloader.undo (C:\Program Files\nodejs\node_modules\autorest\dist\static-loader.js:163:7)
at process.exit (C:\Program Files\nodejs\node_modules\autorest\dist\static-loader.js:170:27)
at main (C:\Users\Mark.autorest\@[email protected]\node_modules\@microsoft.azure\autorest-core\dist\app.js:517:21)
(node:47120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
(node:47120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Shutting Down
Shutting Down
What could be the cause? Its been working so well until now.
Node v12 not supported.
Go back to node v10 LTS
12 is now LTS.
10.17.0 LTS which was released yesterday also throws this
PS C:\Users\v-anevse> autorest --version
AutoRest code generation utility [version: 2.0.4283; node: v10.17.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Showing All Installed Extensions
Type Extension Name Version Location
core @microsoft.azure/autorest-core 2.0.4399 C:\Users\v-anevse\.autorest\@[email protected]
core @microsoft.azure/autorest-core 2.0.4405 C:\Users\v-anevse\.autorest\@[email protected]
core @microsoft.azure/autorest-core 3.0.5537 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.azureresourceschema 2.0.29 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.csharp-v2 2.0.433 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.csharp 2.3.82 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.modeler 2.3.45 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.modeler 2.3.55 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.powershell 2.0.678 C:\Users\v-anevse\.autorest\@[email protected]
extension @microsoft.azure/autorest.remodeler 2.0.382 C:\Users\v-anevse\.autorest\@[email protected]
Failure:
TypeError: volume[member].bind is not a function
TypeError: volume[member].bind is not a function
at patchFilesystem (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:277:43)
at C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:281:18
at Object.global.staticloader.undo (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:163:7)
at process.exit.n [as exit] (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:170:27)
at main (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\app.js:157:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:3440) UnhandledPromiseRejectionWarning: Error: EBADF: bad file descriptor, close
at Object.closeSync (fs.js:403:3)
at StaticVolumeFile.shutdown (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:352:10)
at StaticFilesystem.shutdown (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:406:17)
at process.exit.n [as exit] (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\static-loader.js:169:11)
at main (C:\Users\v-anevse\AppData\Roaming\npm\node_modules\autorest\dist\app.js:239:17)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:3440) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3440) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I am observing the same behavior (which was also reported in #2919). The error is present on 10.17.0, not on 10.16.3. I bisected the regression to nodejs/node@85ce8ef19a. It appears that making fs.promises enumerable causes patchFilesystem in static-link to throw TypeError when it attempts to .bind it.
GAH! They backported it to the v10 stable LTS branch! ARRRRGH!
The good news, it's throwing this error on _exit_ ... so it will still physically work, but it'll throw the error.
I have a fix for the static-linker done -- I did it last week, but I didn't think I'd have to publish the main stable package again yet, but now I clearly do.
lemme go fix this now and republish. Gonna take me a few hours. Stick to 10.16.3 until I can publish an update.
I published a new version (2.0.4407) that doesn't crash on 10.17+ and 12.13+
give it a try, and yell if it's got more problems.
2.0.4407 works for me and does not print the error message. Thanks @fearthecowboy!
Closing as the issue has been resolved.
Most helpful comment
I published a new version (2.0.4407) that doesn't crash on
10.17+and12.13+give it a try, and yell if it's got more problems.