Skip to content
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

UnhandledPromiseRejectionWarning #3279

Closed
markti opened this issue Jul 6, 2019 · 8 comments
Closed

UnhandledPromiseRejectionWarning #3279

markti opened this issue Jul 6, 2019 · 8 comments

Comments

@markti
Copy link

markti commented Jul 6, 2019

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\[email protected][email protected]\[email protected]\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\[email protected][email protected]\[email protected]\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.

@fearthecowboy
Copy link
Member

Node v12 not supported.

Go back to node v10 LTS

@bleroy
Copy link

bleroy commented Oct 21, 2019

12 is now LTS.

@anton-evseev
Copy link

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.

@kevinoid
Copy link
Contributor

kevinoid commented Nov 4, 2019

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.

@fearthecowboy
Copy link
Member

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.

@fearthecowboy
Copy link
Member

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.

@kevinoid
Copy link
Contributor

kevinoid commented Nov 5, 2019

2.0.4407 works for me and does not print the error message. Thanks @fearthecowboy!

@MiYanni
Copy link
Contributor

MiYanni commented Nov 6, 2019

Closing as the issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants