Tag: azure functions

在Azure函数上使用ImageMagick或GraphicsMagick

我正在尝试查看我的公司是否可以使用Azure函数将TIFF文件的转换自动转换为多种JPG和PNG格式和大小。 我使用Node.js函数,但也可以使用其他语言。 我的问题是,我无法得到GraphicsMagick或ImageMagickfunction。 我使用正常的程序安装使用npm安装 。 它似乎安装好,模块也似乎加载,但是当我尝试处理文件时没有任何反应。 没有什么,也没有错误。 var fs = require('fs'); var gm = require('gm'); module.exports = function(context,req){context.log('Start …'); try { context.log('Looking for GM…'); context.log(require.resolve("gm")); } catch(e) { console.log("GM is not found"); process.exit(e.code); } gm('D:/home/site/wwwroot/HttpTriggerJS1/input/870003-02070-main-nfh.jpg') .resize(240, 240) .noProfile() .write('D:/home/site/wwwroot/HttpTriggerJS1/output/resize.jpg', function (err) { context.log('TEST'); if (!err) { context.log('done'); } } ); context.done(null, res); }; 我不确定这是甚至可能的,但我还没有发现任何信息说明它不能 。 […]

无法弄清楚如何生成和查看Bot服务上的nodeJs bot的日志

我最近将自己的nodeJs bot部署到了Bot Service,似乎无法弄清楚如何生成和查看日志。 当我尝试启用日志logging,我不断得到一个未知的错误 查看服务器上的日志文件,没有文件logging节点应用程序 试图login到应用程序的见解,没有成功。 帮帮我?

azure-functions-cli:func init spits错误“No such file or directory”

我使用以下URl安装了7.x NoodeJs, https://github.com/nodesource/distributions # Using Ubuntu curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash – sudo apt-get install -y nodejs 如链接https://blogs.msdn.microsoft.com/appserviceteam/2016/12/01/running-azure-functions-locally-with-the-cli/中所述 ,安装了azure-functions-cli, npm i -g azure-functions-cli 现在,当我运行“func init”时,出现以下错误:$ func init:没有这样的文件或目录 然后我尝试按照以下方式运行,仍然出现错误, $ node /usr/lib/node_modules/azure-functions-cli/lib/main.js init events.js:161 throw er; // Unhandled 'error' event ^ Error: spawn mono /usr/lib/node_modules/azure-functions-cli/bin/func.exe ENOENT at exports._errnoException (util.js:1023:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT […]

如何在JavaScript Azure函数中共享代码?

如何在Azure函数应用程序中的文件之间共享代码(例如,Mongo模式定义)? 我需要这样做,因为我的function需要访问共享的mongo模式和模型,比如这个基本的例子: var blogPostSchema = new mongoose.Schema({ id: 'number', title: 'string', date: 'date', content: 'string' }); var BlogPost = mongoose.model('BlogPost', blogPostSchema); 我已经尝试添加一个"watchDirectories": [ "Shared" ]行到我的host.json并在该文件夹中添加了一个包含上述variables定义的index.js ,但这似乎并没有提供给其他函数。 我只是Exception while executing function: Functions.GetBlogPosts. mscorlib: ReferenceError: BlogPost is not defined得到一个Exception while executing function: Functions.GetBlogPosts. mscorlib: ReferenceError: BlogPost is not defined Exception while executing function: Functions.GetBlogPosts. mscorlib: ReferenceError: BlogPost […]

如何使用绑定更新Azure函数中的Azure表格行?

我正在使用节点和Azure函数来使用在functions.json中定义的绑定来更新我的azure色表。 我能够使用绑定插入行,但无法find任何文档如何更新它们。 Functions.json { "tableName": "myTable", "connection": "myTableConnectionString", "name": "tableBinding", "type": "table", "direction": "out" } 函数定义 Promise.map(loaders.map(e => e.getData()), (data) => { context.log("pushing to azure table"); context.bindings.tableBinding.push({ PartitionKey: data.key, RowKey: data.key, Value: data.Value }); }) .then(() => { context.log("Completed all data retrieveal tasks"); context.log('JavaScript timer trigger function ran!', timeStamp); context.done(); }); 再次调用上面的函数不起作用。 我明白,我可以使用SDK来手动更新表,但我想使用绑定,并保持尽可能简单的function。

版本兼容性问题Azurefunction的Node和DirectlineJS es6导出

最终目标: 使用DirectLine秘密创build运行Botframework-DirectlineJS并绑定到Bot (Framework)天青function。 问题: 上面提到的Botframework-DirectlineJS使用es6 export和Azurefunction支持Node 6.5.0 max doc 。 因此,如何在Azure函数的index.js文件中成功导入DirectlineJS? Errror “` 2017-05-23T07:17:45.939 Exception while executing function: Functions.adapter. mscorlib: D:\home\site\wwwroot\adapter\importexportwrapper.js:1 (function (exports, require, module, __filename, __dirname) { import { DirectLine } from 'botframework-directlinejs'; ^^^^^^ SyntaxError: Unexpected token import at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:528:28) at Object.Module._extensions.(anonymous function) [as .js] (D:\home\site\wwwroot\node_modules\node-hook\index.js:73:14) at Module.load (module.js:473:32) at […]

在Azure函数上部署节点应用程序

我想知道如何在Azure函数上部署Node.js应用程序。 基本上,我有一个function设置,并运行一个基本的hello world http示例,如下所示: module.exports = function (context, req) { context.log('JavaScript HTTP trigger function processed a request.'); context.res = { // status: 200, /* Defaults to 200 */ body: "Hello " + req.params.name }; context.done(); }; 我试图部署到一个函数的应用程序是一个简单的moc客户端,使用swagger(基本上接受请求,并返回一些xml)。 app.js看起来像: const SwaggerExpress = require('swagger-express-mw'); const app = require('express')(); const compression = require('compression'); const configSwagger = { appRoot: […]

如何在Azure函数中添加客户http标头

我尝试从客户端JavaScript应用程序谷歌身份validationazurefunction(nodejs)。 我已经为正确的URL设置了CORS(即http:// localhost:8080 )。 但是我仍然收到以下错误: 凭证标志是'true',但是'Access-Control-Allow-Credentials'标头是''。 允许凭证必须是“真实的”。 原因' http:// localhost:8080 '因此不被允许访问。 我已经在互联网上到处尝试,花了几天时间自己find答案。 看来,Azure http响应需要在标题中添加此Access-Control-Allow-Credentials:true。 有没有办法添加自定义标题? 任何帮助将不胜感激。