microsoft / vscode-azure-iot-edge

Azure IoT Edge for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge
Other
51 stars 36 forks source link

When generating the config json. The docker image does not get set correctly #664

Open AnOdyssey opened 9 months ago

AnOdyssey commented 9 months ago

Steps to Reproduce:

  1. Generate a new project. Parameters don't mather neither does the container registry that gets entered
  2. Generate the config file for running on the simulator
{
  "modulesContent": {
    "$edgeAgent": {
      "properties.desired": {
        "schemaVersion": "1.4",
        "runtime": {
          "type": "docker",
          "settings": {
            "minDockerVersion": "v1.25",
            "loggingOptions": "",
            "registryCredentials": {
              "**Redacted**": {
                "username": "**Redacted**",
                "password": "**Redacted**",
                "address": "**Redacted**"
              }
            }
          }
        },
        "systemModules": {
          "edgeAgent": {
            "type": "docker",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-agent:1.4",
              "createOptions": "{}"
            }
          },
          "edgeHub": {
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-hub:1.4",
              "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"
            }
          }
        },
        "modules": {
          "modbusmodule": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "${MODULES.modbusmodule.debug}",
              "createOptions": "{}"
            }
          },
          "SimulatedTemperatureSensor": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.4",
              "createOptions": "{}"
            }
          },
          "testmodule": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "${MODULES.testmodule}",
              "createOptions": "{}"
            }
          }
        }
      }
    },
    "$edgeHub": {
      "properties.desired": {
        "schemaVersion": "1.4",
        "routes": {
          "modbusmoduleToIoTHub": "FROM /messages/modules/modbusmodule/outputs/* INTO $upstream",
          "sensorTomodbusmodule": "FROM /messages/modules/SimulatedTemperatureSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/modbusmodule/inputs/input1\")",
          "testmoduleToIoTHub": "FROM /messages/modules/testmodule/outputs/* INTO $upstream"
        },
        "storeAndForwardConfiguration": {
          "timeToLiveSecs": 7200
        }
      }
    }
  }
}

This is the generated deployment.debug.amd64.json It seems like the Image url of the modules does not get set correctly.

Does this issue occur when all other extensions are disabled?: Yes

Is this a bug or why is thing happening. Am I missing something else?

AnOdyssey commented 9 months ago

So after some debugging and allot of troubleshooting with different project types and old iotedge projects. I have found what was giving the issues.

When generating a new csharp module the following files are missing and need to be added manually.

  1. All the docker files for the module
  2. module.json

Once these files are added in the output file the image will be set correctly and the docker-compose error will stop.

rido-min commented 9 months ago

Hi @AnOdyssey

Thanks for reporting this issue.

The VSCode IoT Edge extension is in maintenance mode, so new updates to the dotnet template wont be applicable.

If you want to still use this extension it needs to be configured File->Preferences->Settings->IoT Edge configuration->Version Csharpmodule to use 3.2.0

image

or in settings.json

{
   "azure-iot-edge.version.csharpmodule": "3.2.0"
}