This PR fixes an issue I have been running into when calling deploy using serverless/compose, in which, after deploy, I would get this error message:
project › Error: Impossible to parse the output of "serverless info":
An example of the full error:
project › Stack Outputs:
project › BucketName: ...
project › ServerlessDeploymentBucketName: ....
project › Need a better logging experience than CloudWatch? Try our Dev Mode in console: run "serverless --console"
project › error
project › Impossible to parse the output of "serverless info":
project › service: ...
project › stage: dev
project › region: us-east-1
project › stack: ...
project ›
project › Stack Outputs:
project › BucketName: ...
project › ServerlessDeploymentBucketName: ...
project ›
project › Error: Impossible to parse the output of "serverless info":
project › service: ...
project › stage: dev
project › region: us-east-1
project › stack: ...
project ›
project › Stack Outputs:
project › BucketName: ...
project › ServerlessDeploymentBucketName: ...
project ›
project › <stack trace>
Verbose logs are available in ".serverless/compose.log"
> NX ERROR: Something went wrong in run-commands - Command failed: serverless project:deploy
Pass --verbose to see the stacktrace.
Which causes the process to exit with a non-zero exit code, causing things like CI pipeline failures.
I played around with the code a bit and figured out it was the ANSI characters (for colors, I assume) that seemed to be messing up the YAML.parse call. The text looked similar to this:
This PR fixes an issue I have been running into when calling
deploy
usingserverless/compose
, in which, after deploy, I would get this error message:An example of the full error:
Which causes the process to exit with a non-zero exit code, causing things like CI pipeline failures.
I played around with the code a bit and figured out it was the ANSI characters (for colors, I assume) that seemed to be messing up the
YAML.parse
call. The text looked similar to this:By adding a
stripAnsi
call around the text before it is parsed by the YAML parser, we get something that looks much better:All tests still pass, and I was able to verify this fix on my end. Let me know if more is needed.
My system specs:
MacOS Ventura 13.0 ARM (M1 Pro) NPM
8.19.2
Nodev16.15.1
Serverless3.24.0
Compose1.3.0