【问题标题】:Serverless invoke local for Azure is not workingAzure 的本地无服务器调用不起作用
【发布时间】:2020-01-30 14:28:20
【问题描述】:
Serverless invoke local -f function_name -m POST

此命令不适用于 azure 本地。一切都适用于 AWS,但不适用于 Azure。

我可以通过使用无服务器在 azure 上完美部署这些功能,但无法在本地调用。

这是此调用的响应:

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

【问题讨论】:

    标签: azure serverless-framework serverless


    【解决方案1】:

    我自己找到了答案。我很困惑,在 AWS 中,我们不像在 Azure 中那样将它作为服务器运行。就像在 AWS 中一样,我们只是运行无服务器调用命令,它运行该函数并以输出响应,但它在 Azure 中不起作用。在 Azure 中,我们需要先使用命令运行服务器

    serverless offline
    

    然后我们就可以将我们的函数用作服务器了。就像我们可以像使用 express 或任何其他普通服务器一样进行调用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-25
      • 1970-01-01
      • 1970-01-01
      • 2015-11-16
      • 2020-07-20
      • 2012-11-15
      • 1970-01-01
      • 2018-11-08
      相关资源
      最近更新 更多