Describe the bug
Please find a repro project here.
It contains:
It works OK with Yarn Classic but crashes when installed with Yarn Berry.
The repo contains:
To Reproduce
yarn installhapi on http://localhost:3000, open the URL of the endpoint documentation: http://localhost:3000/documentationExpected Behavior
Swagger UI to be displayed with no error in the console.
Actual Result
No UI in the browser,
The following error in the console:
Click for a lot of console output...
(node:20128) UnhandledPromiseRejectionWarning: RangeError [ERR_OUT_OF_RANGE]: The value of "fd" is out of range. It must be >= 0 && <= 2147483647. Received -2147483645
at Object.fstat (fs.js:964:3)
at internal/util.js:297:30
at new Promise (<anonymous>)
at Object.fstat (internal/util.js:296:12)
at exports.File.stat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:63:40)
at exports.File.openStat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:82:21)
at async Object.internals.prepare (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\file.js:107:22)
at async exports.Manager.execute (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\toolkit.js:105:28)
at async Object.internals.handler (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\handler.js:46:20)
at async exports.execute (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\handler.js:31:20)
(node:20128) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:20128) [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.
(node:20128) UnhandledPromiseRejectionWarning: RangeError [ERR_OUT_OF_RANGE]: The value of "fd" is out of range. It must be >= 0 && <= 2147483647. Received -2147483644
at Object.fstat (fs.js:964:3)
at internal/util.js:297:30
at new Promise (<anonymous>)
at Object.fstat (internal/util.js:296:12)
at exports.File.stat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:63:40)
at exports.File.openStat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:82:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.internals.prepare (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\file.js:107:22)
at async exports.Manager.execute (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\toolkit.js:105:28)
at async Object.internals.handler (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\handler.js:46:20)
(node:20128) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
(node:20128) UnhandledPromiseRejectionWarning: RangeError [ERR_OUT_OF_RANGE]: The value of "fd" is out of range. It must be >= 0 && <= 2147483647. Received -2147483643
at Object.fstat (fs.js:964:3)
at internal/util.js:297:30
at new Promise (<anonymous>)
at Object.fstat (internal/util.js:296:12)
at exports.File.stat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:63:40)
at exports.File.openStat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:82:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.internals.prepare (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\file.js:107:22)
at async exports.Manager.execute (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\toolkit.js:105:28)
at async Object.internals.handler (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\handler.js:46:20)
(node:20128) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:20128) UnhandledPromiseRejectionWarning: RangeError [ERR_OUT_OF_RANGE]: The value of "fd" is out of range. It must be >= 0 && <= 2147483647. Received -2147483642
at Object.fstat (fs.js:964:3)
at internal/util.js:297:30
at new Promise (<anonymous>)
at Object.fstat (internal/util.js:296:12)
at exports.File.stat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:63:40)
at exports.File.openStat (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\fs.js:82:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.internals.prepare (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-inert-npm-6.0.3-4c290df46a-82a4a790c8.zip\node_modules\@hapi\inert\lib\file.js:107:22)
at async exports.Manager.execute (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\toolkit.js:105:28)
at async Object.internals.handler (D:\Projects\tests\hapi-swagger\.yarn\cache\@hapi-hapi-npm-20.0.3-d3b5a60d99-7d9a68f8b2.zip\node_modules\@hapi\hapi\lib\handler.js:46:20)
(node:20128) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 12)
Environment if relevant (please complete the following information):
Additional context
The failing line is the following:
const stat = await exports.fstat(this.fd);
Please give me a clue on where to start unpuzzling such issues related to yarn. It does not seem to be related to any wrong dependencies as usual. Thanks.
Implemented support for fstat in https://github.com/yarnpkg/berry/pull/2320, you can try it by using
yarn set version from sources --branch 2320
@merceyz , the fstat fix did the trick, the working project is here Thanks!
Any implications with the failed tests?
Any implications with the failed tests?
No, it's because of a issue with an invalid semver version upstream