fix(invoke): write result as JSON to stdout, errors to stderr#724
Open
fix(invoke): write result as JSON to stdout, errors to stderr#724
Conversation
- JSON.stringify the execution result so it is machine-readable instead of printing [object Object] (#436) - Route the final result to stdout so it can be piped (#592) - Route error output and the post-progress blank line to stderr (#592) Closes #436 Closes #592 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the output of
serverless invoke stepfto be machine-readable and correctly routed by stream.Why
logger.log(result)passed a raw object to the Serverless CLI logger, which printed[object Object]instead of the actual execution result (Getting [object Object] from invoke stepf #436)The two fixes are combined in one commit as they are inseparable — routing to stdout requires serialising the value first.
Note: #435 (
-nshortcut not mapping to--name) was verified as already fixed by a prior change that addedtype: 'string'to the options definition. Closed separately.Closes #436
Closes #592
Test plan
#invoke(): success writes JSON to stdout, failure writes JSON to stderr withexitCode=1, blank line separator goes to stderrnpm test— 500 passing🤖 Generated with Claude Code