Giter VIP home page Giter VIP logo

azure-functions-iothub-extension's People

Contributors

microsoft-github-policy-service[bot] avatar paulbatum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-functions-iothub-extension's Issues

This repo should be deprecated

The documentation in this repo for the IoT extension for Functions is no longer accurate when a user pulls down the nupkg for the IoT extension. It causes unnecessary confusion and should be marked as deprecated in its readme, or removed from GitHub entirely.

Assembly loading issue

Hi,
I am getting below error in my Azure function for C2D code. I have uploaded all the extension DLLs in my Function directory.

Microsoft.Azure.WebJobs.Script.Description.CompilationServiceException : C# compilation service error: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) ---> System.IO.FileLoadException : The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly,Boolean forIntrospection,Boolean raiseResolveEvent)
at System.Reflection.AssemblyName..ctor(String assemblyName)
at Microsoft.Azure.WebJobs.Host.JobHostMetadataProvider.TryResolveAssembly(String assemblyName,Assembly& assembly)
at Microsoft.Azure.WebJobs.Script.Binding.GeneralScriptBindingProvider.TryResolveAssembly(String assemblyName,Assembly& assembly) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Binding\GeneralScriptBindingProvider.cs : 58
at Microsoft.Azure.WebJobs.Script.Description.ExtensionSharedAssemblyProvider.TryResolveAssembly(String assemblyName,Assembly& assembly) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\ExtensionSharedAssemblyProvider.cs : 34
at Microsoft.Azure.WebJobs.Script.Description.FunctionMetadataResolver.ResolveReference(String reference,String baseFilePath,MetadataReferenceProperties properties) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\FunctionMetadataResolver.cs : 172
at Microsoft.CodeAnalysis.CommonReferenceManager2.ResolveReferenceDirective(String reference,Location location,TCompilation compilation) at Microsoft.CodeAnalysis.CommonReferenceManager2.GetCompilationReferences(TCompilation compilation,DiagnosticBag diagnostics,ImmutableArray1& references,IDictionary2& boundReferenceDirectives,ImmutableArray1& referenceDirectiveLocations) at Microsoft.CodeAnalysis.CommonReferenceManager2.ResolveMetadataReferences(TCompilation compilation,Dictionary2 assemblyReferencesBySimpleName,ImmutableArray1& references,IDictionary2& boundReferenceDirectiveMap,ImmutableArray1& boundReferenceDirectives,ImmutableArray1& assemblies,ImmutableArray1& modules,DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateSourceAssemblyForCompilation(CSharpCompilation compilation)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonGetTypeByMetadataName(String metadataName)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver.Initialize(Compilation compilation,CompilationWithAnalyzersOptions analysisOptions,CompilationData compilationData,Boolean categorizeDiagnostics,CancellationToken cancellationToken)
at async Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.ComputeAnalyzerDiagnosticsWithoutStateTrackingAsync(CancellationToken cancellationToken)
at async Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsWithoutStateTrackingAsync(ImmutableArray1 analyzers,CancellationToken cancellationToken) at async Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(??) at async Microsoft.Azure.WebJobs.Script.Description.CSharpCompilation.EmitAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\Compilation\CSharp\CSharpCompilation.cs : 104 End of inner exception at async Microsoft.Azure.WebJobs.Script.Description.CSharpCompilation.EmitAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\Compilation\CSharp\CSharpCompilation.cs : 124 at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.CreateFunctionTarget(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 317 at async Microsoft.Azure.WebJobs.Script.Description.FunctionLoader1.GetFunctionTargetAsync[T](Int32 attemptCount) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\FunctionLoader.cs : 0
at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetFunctionTargetAsync() at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 195
2018-07-26T09:25:17.878 [Info] Function loader reset. Failed compilation result will not be cached.

My Function.JSON looks like this:
{
"bindings": [
{
"type": "eventHubTrigger",
"name": "myEventHubMessage",
"direction": "in",
"path": "messages/events",
"connection": "IOTconnString",
"consumerGroup": "$Default"
},
{
"name": "cloudToDevice",
"type": "ioTCloudToDevice",
"direction": "out",
"connection": "IoTConnectionString"
}
],
"disabled": false
}

Correct path to .dll files is unclear

Hey guys,

Thanks for putting this together!

I started following the instructions and there are a few steps that are unclear from the README. Could you clarify?

To run, do the following:

  1. Zip extension .dll files and put them in Function's library via Advanced tools (Kudu)

I have done this, but I am not sure they are in the right place. The only place that I am able to upload with .dll files is directly into the /wwwroot folder. I tried uploading directly to my function (C2D2), but it would not allow me to upload directly to that folder. My folder is called DLLs.
image

  1. Add the path where the extension lives to appsetting using AzureWebJobs_ExtensionsPath as key

Given the above, I'm not sure the correct path. I have tried a few different iterations, namely /DLLs, /wwwroot/DLLs, D:/DLLs, etc. I receive the following error message:

The function runtime is unable to start. mscorlib: Could not find a part of the path 'D:\DLLs'.

image

Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'cloudToDevice' to type ICollector

Hey guys,

Running into the following error. Not sure what is wrong with my bindings. Running in the portal. Any ideas?

[Error] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.C2D2'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'cloudToDevice' to type ICollector. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

My function.json:

{
  "bindings": [
    {
      "type": "eventHubTrigger",
      "name": "myEventHubMessage",
      "direction": "in",
      "path": "temp_humidity",
      "connection": "razzpi_events_IOTHUB",
      "consumerGroup": "secondconsumergroup"
    },
    {
      "type": "ioTCloudToDevice",
      "name": "cloudToDevice",
      "direction": "out",
      "connection": "razzpi_events_IOTHUB"
    }
  ],
  "disabled": false
}

and run.csx:

#r "Newtonsoft.Json"
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

/* Sending D2C messages to C2D */ 
public static void Run(string myEventHubMessage, ICollector<string> cloudToDevice, ICollector<string> setDeviceTwin, TraceWriter log)
{
    // myEventHubMessage = D2C message 
    log.Info($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
    test
    var msgJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(myEventHubMessage);

    var c2dItem = new
        {
            DeviceId = msgJson["DeviceId"],
            MessageId = msgJson["MessageId"],
            Message = "CLOUD " + msgJson["Message"] 
        };  

    var setDTItem = new
        {
            DeviceId = "receiverCarol",
            UpdateId = msgJson["MessageId"],
            Patch = new
            {
                properties = new
                {
                    desired = new
                    {
                        telemetryConfig = new
                        {
                            configId = Guid.NewGuid().ToString()
                        }
                    }
                }
            }
        };
        

    try {
        cloudToDevice.Add(JsonConvert.SerializeObject(c2dItem));
    }
    catch(Exception e) {
        log.Error("Exception caught for c2dItem method: ", e);
        log.Info("failed to add to Dave");
    }
}

Also, my AzureWebJobs_ExtensionPath app setting:
image

Ship nupkg?

Have these been shipped as Nuget Packages? If so, consider this an issue requesting an update to README.md to include the Install-Package commands to include them in a .Net Function. If not, consider this an issue to create & ship nuget packages for this extension ๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.