azure-functions

Azure Functions error - Cannot bind parameter to type String

余生颓废 提交于 2021-02-08 20:05:00
问题 I am trying to save files to FTP by using an Azure Function. The json is this: { "type": "apiHubFile", "name": "outputFile", "path": "{folder}/ps-{DateTime}.txt", "connection": "ftp_FTP", "direction": "out" } The function code is this: public static void Run(string myEventHubMessage, TraceWriter log, string folder, out string outputFile) { var model = JsonConvert.DeserializeObject<PalmSenseMeasurementInput>(myEventHubMessage); folder = model.FtpFolderName; outputFile = $"{model.Date.ToString(

Azure Functions error - Cannot bind parameter to type String

冷暖自知 提交于 2021-02-08 20:04:43
问题 I am trying to save files to FTP by using an Azure Function. The json is this: { "type": "apiHubFile", "name": "outputFile", "path": "{folder}/ps-{DateTime}.txt", "connection": "ftp_FTP", "direction": "out" } The function code is this: public static void Run(string myEventHubMessage, TraceWriter log, string folder, out string outputFile) { var model = JsonConvert.DeserializeObject<PalmSenseMeasurementInput>(myEventHubMessage); folder = model.FtpFolderName; outputFile = $"{model.Date.ToString(

No template sub-directory with name 'lab' found in the following paths

情到浓时终转凉″ 提交于 2021-02-08 15:38:10
问题 I am running a python azure function which is running a jupyter notebook via the nbconvert API. This was working for a time, although without deploying new code I have started to get the following error: No template sub-directory with name 'lab' found in the following paths:\n\t/home/.local/share/jupyter\n\t/usr/local/share/jupyter\n\t/usr/share/jupyter The code I am using to achieve this is: from nbconvert.preprocessors import ExecutePreprocessor from nbconvert import HTMLExporter ... dl =

Azure function V3 could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0 with EF core 5.0-rc1

梦想与她 提交于 2021-02-08 13:08:49
问题 Case We are creating azure function v3 with .netcore 3.1. Using EF core 5.0-rc1 and Depdency Injection 1) DependecyInjection [assembly: FunctionsStartup(typeof(xxxxx.Startup))] namespace xxxxx { public class Startup : FunctionsStartup { public override void Configure(IFunctionsHostBuilder builder) { var services = builder.Services; var configBuilder = new ConfigurationBuilder() .SetBasePath(Environment.CurrentDirectory) .AddJsonFile("local.settings.json", true, reloadOnChange: true)

how to create folder in blob storage

有些话、适合烂在心里 提交于 2021-02-08 10:27:18
问题 I have a file such as Parent.zip and when unzipped, it will yield these files: child1.jpg , child2.txt , child3.pdf . When running Parent.zip through the function below, the files are correctly unzipped to: some-container/child1.jpg some-container/child2.txt some-container/child3.pdf How do I unzip the files to their parent folder? The desired result would be: some-container/Parent/child1.jpg some-container/Parent/child2.txt some-container/Parent/child3.pdf As you can see above the folder

Ping server from Azure Function

大城市里の小女人 提交于 2021-02-08 09:14:42
问题 I have the following Azure Function that fails with Access is Denied (ignore the fact that the logic is all weird, I'm just doing a first test) public static void Run(TimerInfo myTimer, ILogger log) { List<string> servers = new List<string>() { "server1" }; foreach(string server in servers) { if (!Ping(server)) { SendEmail($"Server {server} seems down.", log); } } } static bool Ping(string hostName) { Ping pingSender = new Ping(); int timeout = 120; PingReply reply = pingSender.Send(hostName,

Deploying multiple function under same azure function app not working

微笑、不失礼 提交于 2021-02-08 07:49:21
问题 Trying to deploy 3 functions of different types(CosmosDBTrigger/TimerTrigger/HttpTrigger) in the same azure function app service account, attached the folder structure for reference. Functions are not working as expected but throwing error after successful deployment. Expection received: Function (CopyToQueue) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'CopyToQueue'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter ' inputCloudSyncJobModels ' to type IEnumerable`1. Make

Azure function run code on startup for Node

帅比萌擦擦* 提交于 2021-02-08 07:37:25
问题 I am developing Chatbot using Azure functions. I want to load the some of the conversations for Chatbot from a file. I am looking for a way to load these conversation data before the function app starts with some function callback. Is there a way load the conversation data only once when the function app is started? This question is actually a duplicate of Azure Function run code on startup. But this question is asked for C# and I wanted a way to do the same thing in NodeJS 回答1: You can use

How to upload a file in html page, using http trigger in azure functions using python?

安稳与你 提交于 2021-02-08 07:36:17
问题 I would like to have a some way, how to upload a file (could be html without php, or some interactive azure upload page, whatever), and through my URL params I would like to send parameters, which will run the rest of code using this uploaded file (ofc I need to save it to blob at least). I need a rest api, so i chose azure functions. Is there any way how to do it in python? I saw lots of examples in C#, but docs for python are limited. Thx a lot! 回答1: Regarding the issue, you can use Html

Running Playwright in Azure Function

廉价感情. 提交于 2021-02-08 07:26:12
问题 I'm trying to run a simple Azure Function that would enter page and generate a PDF depending on what is visible in a browser. I created a NodeJS 12 Azure Function with Linux Consumption Plan (B1). I set PLAYWRIGHT_BROWSERS_PATH to 0 . Function code looks like this: const { chromium } = require("playwright-chromium"); const baseUrl = "http://someurl"; const targetPage = "/action/"; module.exports = async function (context, req) { const browser = await chromium.launch(); const page = await