Node.js 中的 Azure 函数和共享文件 [英] Azure Function in Node.js and shared files

查看:14
本文介绍了Node.js 中的 Azure 函数和共享文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 Bitbucket CI 部署我的 Azure Functions.我可以在多个函数中引用共享目录中的文件,这很棒.

I am deploying my Azure Functions through a Bitbucket CI. I am able to reference files from a shared directory in multiple functions which is great.

但是,当我尝试更新我的共享代码并通过推送到我的主分支来部署它时,我可以在我的 Kudu 控制台中看到正在更新的文件,但我的函数本身似乎仍然引用了旧版本的文件...如果我关闭我的 CI 就没有这个问题.

However, when I try to update my shared code and deploy it by pushing to my master branch, I can see the files being updated in my Kudu console, but my functions themselves still appear to have a reference to the old version of the file... I don't have this problem if I turn off my CI.

知道问题可能是什么以及如何解决这个问题吗?

Any idea what the problem could be and how to work around this?

推荐答案

您可以通过将自定义共享目录添加到您的 host 中的 watchDirectories 数组中来指定应监视更改的自定义共享目录.json 文件:

You can specify that your custom shared directories should be monitored for changes by adding them to a watchDirectories array in your host.json file:

{
    "watchDirectories": [ "Shared" ]
}

然后,运行时将监视这些目录中的文件的更改,并在必要时重新启动/重新加载.请注意,默认情况下会配置对顶级 node_modules 目录的监控.

The runtime will then monitor files in those directories for changes, and restart/reload as necessary. Note that monitoring for a top level node_modules directory is configured by default.

这篇关于Node.js 中的 Azure 函数和共享文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆