Describe the bug
When upgrading to Storybook 6.x, our CI build was still green since the error was related to the config files and didn't exit as an error, making it easy to miss:
$ build-storybook --output-dir ./dist/ --debug-webpack --loglevel warn --quiet
(node:3164) UnhandledPromiseRejectionWarning: Error: You have both a "main" and a "config". Please remove the "config" file from your configDir (/home/runner/work/<redacted>/.storybook/config)
at validateConfigurationFiles (/home/runner/work/<redacted>/node_modules/@storybook/core/dist/server/utils/validate-configuration-files.js:57:11)
at loadCustomPresets (/home/runner/work/<redacted>/node_modules/@storybook/core/dist/server/common/custom-presets.js:19:43)
at _default (/home/runner/work/<redacted>node_modules/@storybook/core/dist/server/manager/manager-config.js:160:143)
at buildManager (/home/runner/work/<redacted>/node_modules/@storybook/core/dist/server/build-static.js:178:56)
at buildStaticStandalone (/home/runner/work/<redacted>/node_modules/@storybook/core/dist/server/build-static.js:253:9)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3164) 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: 2)
(node:3164) [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.
Done in 1.69s.
To Reproduce
Steps to reproduce the behavior:
main and config files)build-storybook0 exit codeExpected behavior
build-storybook should exit with code 1
Screenshots
N/A
Code snippets
N/A
System:
~Please paste the results of npx sb@next info here.~
GitHub Actions, Node 14
Additional context
N/A
was this working before in 5.3 or whatever version you were upgrading from?
@shilman I assumed the validateConfigurationFiles check was added because of the config file renames in 6.x? I could test it with our old config, but what would an invalid setup look like in 5.3?
Aha i guess there's no way you could know since that error didn't exist in 5.3 馃檲
Looks like we should add some code to the bins so the process.exit(1) when a promise is thrown?
@nihalgonsalves would you be open to adding this?
https://github.com/storybookjs/storybook/blob/ef14ecf3b5a61e0045ceaa4a310f7ec7c0a0e2fb/app/rax/src/server/build.js#L4
this should do:
buildStatic(options).catch(e => console.error(e) || process.exit(1))
We'd have to change this for all frameworks we support.
@ndelangen yup, I can take a look. Another way to do it would be this:
process.on('unhandledRejection', e => { /* ... */ });
ow that would mean we'd have to touch way less files!
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
should be fixed by: https://github.com/storybookjs/storybook/pull/13018
Most helpful comment
@ndelangen yup, I can take a look. Another way to do it would be this: