OPCPublisher is in error state

Khandu Shinde 110 Reputation points
2024-05-16T09:05:29.82+00:00

Hi Team,

We have OPCPublisher IoT edge module is in error state. Please find below error log. It indicates publishednodes.json file has one parameter OpcAuthenticationMode which is empty. But all the required fields in publishednodes.json file have valid details.

My question is what is the location of /appdata/publishednodes.json file? Where is the issue to make this edge module up?

Thanks in advance!

[12:39:05 INF Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory] Connecting all clients to XXXXX using MqttOverTcp.
[12:39:05 INF Root] Starting module OpcPublisher version x.x.xxx.xxxx.
[12:39:05 INF Root] Initiating prometheus at port 9702/metrics
[12:39:05 INF Root] Prometheus metric server started.
[12:39:05 WRN Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory] Bypassing certificate validation for client.
[12:39:05 INF Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory] Running in iotedge context.
[12:39:06 INF Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory] 0: Module iot-edge_OPCPublisher reconnected due to Connection_Ok.
[12:39:06 INF Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost] Initialize device twin for iot-edge - OPCPublisher
[12:39:06 INF Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost] Applying initial desired state.
[12:39:06 INF Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost] Reporting currently initial state.
[12:39:06 INF Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost] Module Host started.
[12:39:06 INF Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor] Creating new worker...
[12:39:06 INF Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.LegacyJobOrchestrator] File /appdata/publishednodes.json has changed, reloading...
[12:39:06 ERR Root] Error during module execution - restarting!
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker -> Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.LegacyJobOrchestrator.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Models.PublishedNodesJobConverter, Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.ILegacyCliModelProvider, Microsoft.Azure.IIoT.Agent.Framework.IAgentConfigProvider, Microsoft.Azure.IIoT.Agent.Framework.IJobSerializer, Serilog.ILogger, Microsoft.Azure.IIoT.Module.IIdentity)' on type 'LegacyJobOrchestrator'.
 ---> Newtonsoft.Json.JsonSerializationException: Error converting value "" to type 'Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Models.PublishedNodesJobConverter+OpcAuthenticationMode'. Path '[0].OpcAuthenticationMode', line 5, position 31.
 ---> System.ArgumentException: Must specify valid information for parsing in the string.
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(TextReader reader, Type objectType)

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
576 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,205 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 33,146 Reputation points MVP
    2024-05-16T18:40:14.27+00:00

    Hello @Khandu Shinde ,

    welcome to this moderated Azure community forum.

    Can you check this blog post regarding the OpcPublisher?

    It's a couple of years old but it's probably still valid.

    Check out the container create options of the module:

    {
        "Hostname": "publisher",
        "Cmd": [
            "--pf=/appdata/pn.json",
            "--aa",
            "--ms=0",
            "--si=10",
            "--ll=verbose",
            "--to"
        ],
        "HostConfig": {
            "Binds": [
                "/var/iiotedge:/appdata"
            ]
        }
    }
    

    Notice the local appdata folder pointing to a folder on the file system?

    Be sure to give the module access to the folder:

    sudo chmod 777 /var/iiotedge
    sudo chmod 777 /var/iiotedge/*
    

    Notice this '777' is great for testing. In production be more specific about the access.

    Another neat trick is to go inside the module while it is running to inspect the internal file system:

    sudo docker exec -i -t [the name of your OPCPublisher module] /bin/bash
    

    The OpcPublisher is very sensitive but this approach should work in most cases.

    From there, make changes one at a time.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.