0
votes
Serverless invoke local -f function_name -m POST

This command is not working on local for azure. Everything is working perfectly for AWS but not for Azure.

I'm able to deploy these functions perfectly on azure by using serverless but not able to invoke locally.

Here is the response of this invocation:

Serverless: URL for invocation: http://localhost:7071/api/project
Serverless: Invoking function createProject with POST request

  Error --------------------------------------------------

  Error: connect ECONNREFUSED 127.0.0.1:7071
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              10.16.3
     Framework Version:         1.53.0
     Plugin Version:            3.1.0
     SDK Version:               2.1.1
     Components Core Version:   1.1.1
     Components CLI Version:    1.2.3

1

1 Answers

0
votes

I found the answer my self. I was confused, in AWS we don't run it as server as we need to do in Azure. Like in AWS we jut run serverless invoke command and it run the function and respond with an output but it does not work in Azure. In Azure we need to run the server first by using the command

serverless offline

and then we'll be able to use our functions as a server. Like we can make the calls as we're used to do with express or any other normal server.