serverless / serverless/examples

Trying to run serverless command from node.js child process

Open
#441 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.5k
Forks
4.4k
Avg merge
2h 55m
Merged PRs (30d)
3

Description

I'm trying to run the serverless command using node.js child process to test locally before deploying to production. Here's the command I'm using:

serverless invoke local --function x

I'm running it via:

    exec(
      `serverless invoke local --function x -l`,
      (error, stdout, stderr) => {
        if (error) {
          console.log("rejected", error)
          throw error
        } else {
          console.log(2345, stdout, stderr)
        }
      }
    )

I can see a node process being created by running top and monitoring it. But it switches between status: stuck and sleeping. It fails to execute.

Command works fine via the terminal so i'm guessing this has nothing to do with my config.

any help is appreciated!

Contributor guide

No contributing guide indexed for this repository

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 the Node.js child-process exec call shown in the issue and reproduce serverless invoke local --function x -l outside the terminal context. Compare the child process behavior with the terminal invocation; done means the command executes successfully and the callback reports its output or a clearly diagnosed failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.