Lec*_*dal 5 azure node.js azure-functions
我已经使用 Azure CLI 创建了一个应用程序和一个函数,它具有适当的结构,因此:
/host.json
/local.settings.json
/mycustomfunction/function.json
/mycustomfunction/index.js
/mycustomfunction/package.json
/node_modules
Run Code Online (Sandbox Code Playgroud)
源代码从 BitBucket 下载,用 Kudu 部署,构建(获取node_modules,azure 是其中之一),一切都是绿色的。
当涉及到依赖项时,只有一个 - "azure": "^2.0.0-preview"
但是当我在 Azure 上运行该函数时,出现错误
2017-09-08T13:59:06.091 JavaScript HTTP trigger function processed a request.
2017-09-08T13:59:06.216 Exception while executing function: Functions.mycustomfunction. mscorlib: Error: Cannot find module 'azure'
at Function.Module._resolveFilename (module.js:469:15)
使用func host start
...运行时,相同的函数在本地运行良好
我究竟做错了什么?:)
问题似乎出在 Azure Functions 的共享/消耗模型上。我注意到,在运行时npm install
,大多数情况下进程都会超时,文件夹中不会显示任何包,node_modules
只.staging
留下文件夹。使用专用应用程序服务计划创建新的功能应用程序后,一切都按预期进行。
另一个(可能更好)的解决方案是包含azure-sb
模块,instead of azure
. 它提供了足够的功能来查询 Azure 服务总线,同时它的体积要小得多,而且即使使用共享层资源,Kudu 也能够获取它。
归档时间: |
|
查看次数: |
11159 次 |
最近记录: |