`next-sitemap` does not exit with a non-zero exit code when an error occur
See original GitHub issueDescribe the bug
next-sitemap
does not exit with a non-zero exit code when an error is encountered.
To Reproduce With the following configuration file:
throw new Error("error")
Running npx next-sitemap --config ./path/to/config.js
yields the following error:
❯ npx next-sitemap --config ./next-sitemap.js
Loaded env from /.env.local
(node:14742) UnhandledPromiseRejectionWarning: Error: error
at Object.<anonymous> (/next-sitemap.js:5:7)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.exports.loadFile (/node_modules/next-sitemap/dist/cjs/file/index.js:12:16)
at Object.exports.loadConfig (/node_modules/next-sitemap/dist/cjs/config/index.js:16:31)
at /node_modules/next-sitemap/dist/cjs/cli.js:24:27
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14742) 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: 1)
(node:14742) [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.
However, next-sitemap
exited with a code of 0:
❯ echo $?
0
Expected behavior
I’d expect next-sitemap
to exit with a non-zero status code, so to fail my build.
Additional information
We’re using next-sitemap@1.6.203
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Build fails with "Command failed with a nonzero exit code"
I had the error Command LinkStoryboards failed with a nonzero exit code , and found that I was using a reference to a...
Read more >script process does not end with non-zero exit code when it fails
The exit code is valid, it's an error, because you have issues with your config file.
Read more >`next-sitemap` does not exit with a non-zero exit code when ...
`next-sitemap` does not exit with a non-zero exit code when an error occur. This issue has been tracked since 2021-12-13. Describe the bug...
Read more >CodeSign error (nonzero exit code) HELP - Apple Developer
I use this image resource programmatically. Failed again and again. Removing the image removed the problem. I found the image file WAS NOT...
Read more >next-sitemap - npm
If your function returns a path that already exists, then it will simply be updated, duplication will not happen.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@teinett This package do support custom build folder. Just set the “sourceDir” in your next-sitemap.js
Check the configuration options in ReadMe to know more about this.
@iamvishnusankar Ok, I found this option. I will try it in my code.
Thanks a lot for your package and fast replies here!