Azure 的无服务器调用本地不起作用
Serverless invoke local for Azure is not working
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
我自己找到了答案。我很困惑,在 AWS 中,我们不需要 运行 它作为服务器,而我们需要在 Azure 中这样做。就像在 AWS 中一样,我们只是 运行 无服务器调用命令,它 运行 函数并以输出响应,但它在 Azure 中不起作用。在 Azure 中,我们需要先使用命令
运行 服务器
serverless offline
然后我们就可以将我们的功能用作服务器。就像我们可以像过去一样使用 express 或任何其他普通服务器进行调用。
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
我自己找到了答案。我很困惑,在 AWS 中,我们不需要 运行 它作为服务器,而我们需要在 Azure 中这样做。就像在 AWS 中一样,我们只是 运行 无服务器调用命令,它 运行 函数并以输出响应,但它在 Azure 中不起作用。在 Azure 中,我们需要先使用命令
运行 服务器serverless offline
然后我们就可以将我们的功能用作服务器。就像我们可以像过去一样使用 express 或任何其他普通服务器进行调用。