bump-sh/cli

Dry-run sometimes fails with error

avinesse opened this issue · 3 comments

Hello!

I am using bump-cli in my gitlab-ci. It works well most of the time, whether documentation has changed or not.
But sometimes, it throws the error below (as I do a --dry-run before the real deploy and can't reproduce everytime, I don't know if I would get the same error during the real deploy).

$ npm install -g bump-cli
$ bump deploy --dry-run bump/diff.json --token ${BUMP_TOKEN} --doc engagement --branch ${CI_COMMIT_BRANCH}
 ›   Error: Error parsing /builds/rh/engagement/pfe/bump/diff.json: 
 ›   unexpected end of the stream within a flow collection (2:1)
 ›
 ›    1 | { "openapi": "3.0.0", "info": {  ...
 ›    2 | 
 ›   -----^

The way I generate the json file does not change. Do you know what could cause this error?
Thank you !

Hi @avinesse,

After a small investigation it seems that this error comes from the js-yaml library as the given JSON file is transformed into YAML format internally in the bump-cli tool.

So it seems the given input file bump/diff.json is badly formed in some way. Do you have the possibility to retrieve the content of that bump/diff.json file after you encounter such an error so we can investigate further please?

You can send us the file at hello@bump.sh if you don't want to share it here publicly on GitHub.
Thanks for your help and let's try to understand what's going on here together!

Hi there, thank you for the quick reply.
I was able to print a failing json in my CI. It seems the json is just cut off in the middle for some reason. So maybe I should be opening this issue with api-platform instead, sorry about that!
Just a quick question before I close the issue: if I wanted to send a yaml doc instead to avoid this change of format, I can just do it using the same command like this ?

bump deploy --dry-run bump/diff.yaml --token ${BUMP_TOKEN} --doc engagement --branch ${CI_COMMIT_BRANCH}

Hi @avinesse,
Yes you can send either JSON or YAML format for you api definition file. The CLI will understand both.

Happy you found the problem in the orignal file and I hope you will be able to fix your issue.