Skip to content

Panic when device is missing CardName or SerialNumber (Minnesota) #263

@presatish

Description

@presatish

🐞 Bug Report

Affected Services [REQUIRED]

device-usb-camera

Is this a regression?

No

Description and Minimal Reproduction [REQUIRED]

  • Run 3.0 version of Edgex core services along with device-usb-camera service (with discovery disabled)
  • Add usb camera manually using REST endpoint and omit CardName and/or SerialNumber info while adding. E.g.
curl -X POST -H 'Content-Type: application/json'  http://localhost:59881/api/v2/device -d '[
    {
    "apiVersion" : "v2",
    "device": {
        "name": "usb-camera",
        "serviceName": "device-usb-camera",
        "profileName": "USB-Camera-General",
        "description": "My test camera",
        "adminState": "UNLOCKED",
        "operatingState": "UP",
        "protocols": {
            "USB": {
                "CardName": "Webcam C270 HD",
                "Path": "/dev/video0",
                "AutoStreaming": "false"
            }
        }
    }
    }
]'
  • The device is successfully added into Edgex but when we execute some command on the device such as StartStreaming the device-usb-camera service panics with the error panic: interface conversion: interface {} is nil, not string and eventually exits.

🔥 Exception or Error

panic: interface conversion: interface {} is nil, not string

🌍 Your Environment

Deployment Environment: Docker, Docker + Dev Hybrid

EdgeX Version [REQUIRED]: 3.0

Anything else relevant?
This issue will be fixed in main. CardName and SerialNumber are optional parameters but the service does not have proper checks and when the device is added manually without one or both of these parameters the issue is seen. With the fixed service, based on their respective needs users can manually add a camera with or without these parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions