Tag: 蓝色的azurefunction

Azure函数+ node.js – 找不到模块

我已经创build了一个具有适当结构的Azure CLI的应用程序和函数,因此: /host.json /local.settings.json /mycustomfunction/function.json /mycustomfunction/index.js /mycustomfunction/package.json /node_modules 源代码从BitBucket下载,与Kudu部署,build立( 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时,相同的function在本地工作正常… 我究竟做错了什么? 🙂

Azurefunction,缩略图图像大小比原始图像大

我已经使用这个背景图像缩略图处理与Azure函数和 NodeJS文章创build缩略图image.An图像创build成功,但图像的大小已经增加。怎么会发生? 它一定是非常小的没有? 我怎样才能解决这个奇怪的问题? 这是Blob存储上的原始图像 处理后(缩略图) 这是Azurefunction(节点): var Jimp = require("jimp"); module.exports = (context, myBlob) => { // Read image with Jimp Jimp.read(myBlob).then((image) => { // Manipulate image image .resize(200, Jimp.AUTO) .greyscale() .getBuffer(Jimp.MIME_JPEG, (error, stream) => { // Check for errors if (error) { context.log(`There was an error processing the image.`); context.done(error); } else { […]

设置缩略图图像内容types

我需要为缩略图图像设置Content-Type 。 我尝试过,如下图所示。但它不起作用。但是,它存储为一个stream。 天青function: index.json var Jimp = require("jimp"); module.exports = (context, myBlob) => { // Read image with Jimp Jimp.read(myBlob).then((image) => { // Manipulate image image .resize(200, Jimp.AUTO) .greyscale() .getBuffer(Jimp.MIME_JPEG, (error, stream) => { if (error) { context.log(`There was an error processing the image.`); context.done(error); } else { context.log(`Successfully processed the image`); stream.set("Content-Type", Jimp.MIME_JPEG); […]

具有node.js,Azure Service Bus和Apps Insight的Azure函数 – 设置AppsInsights时出错

当我使用azure模块(查询Service Bus)和Application Insights模块时,在AppsInsight初始化时出现以下错误: System.Exception : Error: Zone already loaded. at new Error (native) at Error.AppInsightsAsyncCorrelatedErrorWrapper 复制代码非常简单: var azure = require('azure'); var serviceBusService = azure.createServiceBusService(<Service Bus Endpoint>); const appInsights = require("applicationinsights"); appInsights.setup(<Apps Insight key>).start(); 在最后一行抛出错误,我假设是azure和applicationinsights模块之间的依赖关系重叠的结果。 任何build议如何克服这个赞赏!

Node.js中的Azure函数和共享文件

我正在通过Bitbucket CI部署我的Azurefunction。 我能够从多个function的共享目录引用文件,这是很好的。 但是,当我尝试更新我的共享代码并通过推送到我的主分支来部署它时,我可以看到在我的Kudu控制台中正在更新的文件,但是我的函数本身似乎仍然有一个对旧版本文件的引用。 ..如果我closures我的CI,我没有这个问题。 任何想法可能是什么,以及如何解决这个问题?

Azure函数:如何在WebStorm中进行debugging?

azure-functions-cli 提供了一种启动debugging的方法 ,但是这些说明似乎是特定于Visual Studio的。 我尝试在WebStorm中设置一个运行configuration文件来指向JavaScript文件: \node_modules\azure-functions-cli\lib\main.js 然后传递应用程序参数: run myFunctionName –debug 这成功地运行了Azure工具的function,但WebStorm都尝试设置一个debugging端口; 当Azure窗口打开时,它会设置自己的debugging端口。 从Webstorm: C:\Program Files (x86)\JetBrains\WebStorm 2016.2.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" –debug-brk=60168 –expose_debug_as=v8debug C:\Users\username\AppData\Roaming\npm\node_modules\azure-functions-cli\lib\main.js run myfunction –debug Debugger listening on [::]:60168 System.Net.Http.HttpRequestException: An error occurred while sending the request. —> System.Net.WebException: 同样,Azure-cli说它打开一个debugging端口,但它们不匹配。 因此,调用函数时会忽略断点(尽pipe它成功运行)。 任何人都知道如何正确configuration这个能够使用WebStorm进行debugging?

Azure函数压缩POST正文

我有与Http触发器nodejs azurefunction。 我正在使用POST方法并将身体发送到azure色的function。 由于身材很大,所以使用gzip压缩。 我在azure函数中获取请求,内容编docker是“gzip”。 我试图使用nodejs zlib.gunzip(req.body,…) 它抛出一个错误 错误:不正确的标题检查

Azure函数 – NodeJS – 作为stream的响应主体

当你点击给定的Azure函数端点时,我想从Blob存储中返回一个文件。 这个文件是二进制数据。 根据Azure存储Blob文档,最相关的调用似乎是以下内容,因为它是唯一不需要将文件写入临时文件的getBlobToStream : getBlobToStream 然而,这个调用获取Blob并将其写入stream中。 有没有一种方法使用Azure函数将Stream作为res.body的值,以便我可以从存储中获取Blob内容并立即将其写入响应? 要添加一些代码,试图得到这样的工作: 'use strict'; const azure = require('azure-storage'), stream = require('stream'); const BLOB_CONTAINER = 'DeContainer'; module.exports = function(context){ var file = context.bindingData.file; var blobService = azure.createBlobService(); var outputStream = new stream.Writable(); blobService.getBlobToStream(BLOB_CONTAINER, file, outputStream, function(error, serverBlob) { if(error) { FileNotFound(context); } else { context.res = { status: 200, headers: […]

填充队列时Azure函数中的超时

我们有一个简单的ETL过程来从一个API中提取数据到一个我们想用函数实现的文档数据库。 简单地说,这个过程是取一个约16,500行文件,从每行(function1)中提取一个ID,为每个ID(function2)build立一个URL,使用URL(function3)打一个API,存储响应在文件DB(function4)中。 我们正在使用队列进行function间通信,并在执行此操作时在第一个function中看到超时问题。 函数1(index.js) module.exports = function (context, odsDataFile) { context.log('JavaScript blob trigger function processed blob \n Name:', context.bindingData.odaDataFile, '\n Blob Size:', odsDataFile.length, 'Bytes'); const odsCodes = []; odsDataFile.split('\n').map((line) => { const columns = line.split(','); if (columns[12] === 'A') { odsCodes.push({ 'odsCode': columns[0], 'orgType': 'pharmacy', }); } }); context.bindings.odsCodes = odsCodes; context.log(`A total of: ${odsCodes.length} […]