serverless-google-cloudfunctions: "invoke local" doesn't do anything

I’m using the default Node.js template. Running invoke works perfectly fine on the deployed application, but running sls invoke local -f first doesn’t do anything or print anything to the console.

When logging debug info no errors are shown. It gets to Serverless: Invoke invoke:local then the process just exits.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 5
  • Comments: 16

Most upvoted comments

Same here.

Any updates about it?

Any update for this? Workaround dont work for me. When i invoke in shell

serverless invoke local -f first --data '{"name": "Bernie"}'

nothing happens. this doesn’t do anything or print anything to the console

Well yes I confirm, the following config “just works” for me right now:

` {

  "type": "node",

  "request": "launch",

  "name": "Test running lambda sls",

  "program": "${workspaceFolder}/node_modules/.bin/sls",

  "args": [

    "invoke",

    "local",

    "-f",

    "myLambdaFunction",

    "--data",

    "dummyData"

  ]

} `

If I remove the “–data dummyData” section, Invoke Lambda gets stuck as before. Latest Vscode, and my OS is an Ubuntu 18.04 LTS in case it matters…

I am experiencing the same thing, except rather than hanging it just exits after “Serverless: Invoke invoke:local” with no output or even attempting to compile the code (introducing a deliberate syntax error doesn’t have any effect). Seems like maybe this plugin is not ready for use?

I also run into this issue as well. The debug output looks like this:

Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Invoke invoke:local

Afterwards it stops and the return value is 0.

Just ran into this problem, it seems to happen when two conditions are met:

  • you run the sls invoke local command via a debugger (Vscode in my case), and:
  • no input data was provided to invoke local (via either data or path parameters).

In that scenario, InvokeLocal plugin gets stuck trying to read data on stdin. The problem seems to be located in get-stdin/index.js, where the condition if (stdin.isTTY) is false for some reason. May be related to the way VScode calls programs to debug?!

An easy workaround is to add a dummy --data or --path parameter to your invoke local command.

Same here.

Any updates about it?