serverless / compose

Orchestrate Serverless Framework in monorepos
https://serverless.com/framework/docs/guides/compose
MIT License
111 stars 15 forks source link

non-YAML content in serverless info breaking deploy #105

Closed alice-byb closed 2 years ago

alice-byb commented 2 years ago

When deploying a service that outputs non-YAML content during the after:info:info phase (ie printed in serverless info), this causes the deploy command to exit with a non-zero code. This is the line of code that seems to be failing: components/framework/serverless.js#L245

I believe this was discussed on a PR in this repo also: https://github.com/serverless/compose/pull/60#discussion_r840470807

In this case, I encountered this issue for two plugins, one being a plugin maintained by myself which I have fixed, and the other being serverless-domain-manager to which I have opened this issue: https://github.com/amplify-education/serverless-domain-manager/issues/500 and should hopefully be easily fixable.

I believe this could be a bigger issue for other plugins that either don't have active maintenance or potentially have a workflow including non-YAML information in their info output.

From what I understand reading the compose code (please correct me if I am mistaken), is that this functionality is used to generate the outputs after function deployment. Is it necessary to execute this workflow if not sharing outputs between services in the serverless-compose.yml file?

To replicate this issue I created an example repo which shows the following output when deploying (The failure here is due to the line of hyphens in the serverless-domain-manager output):

Screen Shot 2022-04-27 at 4 34 09 pm
mnapoli commented 2 years ago

Got it, thanks for all the pointers!

I'll give this a try in a moment, I think we can make the parsing a bit more robust to account for these cases.

From what I understand reading the compose code (please correct me if I am mistaken), is that this functionality is used to generate the outputs after function deployment. Is it necessary to execute this workflow if not sharing outputs between services in the serverless-compose.yml file?

To answer this, theoretically no, we could skip it. But in practice we store outputs anyway, and resolve them all the time. So it's not an option we can take right now.

mnapoli commented 2 years ago

@bailey-byb I've opened #107 and tested it with the serverless-domain-manager output.

Would you have a chance to test this with your custom plugin?

alice-byb commented 2 years ago

Thanks @mnapoli & @pgrzesik for the fast turnaround. I can see this fixes for both domain-manager & our plugin at the previous version (which actually seemed to print from constructor above the stack outputs section, which seems irresponsible anyway...)

Thank you both! 😀

mnapoli commented 2 years ago

Awesome, thanks for confirming 👍