serverless / serverless/serverless

Allow raw output from `sls invoke` without JSON encoding

Open
#11,376 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

Is there an existing issue for this?
  • I have searched existing issues, it hasn't been reported yet
Use case description

It would be useful to be able to able to get the raw output from the invoke command, similar to how the --raw switch works for input. The invoke and the invoke local commands stringify the output.

At the moment to generate a CSV file the output must be unstringified:

sls invoke local -f export --data XXX | node -e 'console.log(JSON.parse(fs.readFileSync("/dev/stdin", "utf-8")));' > out.csv
Proposed solution (optional)

Adding a --rawOutput command switch.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/plugins/aws/invoke.js and lib/plugins/aws/invoke-local/index.js, where the issue identifies the output stringification. Trace how the invoke commands parse options and emit output, then add the proposed --rawOutput behavior while preserving the existing default. Done means both commands can emit raw output without JSON encoding when the switch is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.