Azure / iotedgedev

The Azure IoT Edge Dev Tool greatly simplifies your Azure IoT Edge development process. It has everything you need to get started and helps with your day-to-day Edge development.
https://aka.ms/iotedgedev
Other
160 stars 70 forks source link

deploy task gives error "Failed to parse json for argument 'content' with exception" #509

Closed florissmit10 closed 3 years ago

florissmit10 commented 3 years ago

When deploying our application on an edge device, an error is thrown.

Steps to Reproduce:

  1. iotedgedev build -f deployment.debug.template.json --push
  2. iotedgedev deploy -f config/deployment.debug.amd64.json

Gives error:

(base) root@VI214591:/mnt/c/Users//src/iotedge.module# iotedgedev deploy -f config/deployment.debug.amd64.json

=======================================
======== ENVIRONMENT VARIABLES ========
=======================================

Environment Variables loaded from: .env (/mnt/c/Users//src/iotedge.module/.env)

=========================================
======== DEPLOYING CONFIGURATION ========
=========================================

Deploying 'config/deployment.debug.amd64.json' to ''...

The json payload for argument 'content' looks like its intended from a file. Please ensure the file path is correct.
Failed to parse json for argument 'content' with exception:
    Expecting value: line 1 column 1 (char 0)
ERROR: Failed to deploy '/mnt/c/Users//src/iotedge.module/config/deployment.debug.amd64.json' to ''...

Does anyone have an idea how to fix/workaround? Im currently starting vscode only to do the deploy step, but I want to move away from it. Im also curious if it is possible to get more information (stacktrace, etc) about what is going wrong, but I couldnt find anything in the docs.

cindydeng1998 commented 3 years ago

Hello @florissmit10, I see that you are using both iotedgedev commands build and deploy with a deployment debug manifest, config/deployment.debug.amd64.json. The proper file is the config\deployment.amd64.json file. Please give this a try and let us know if you run into any issues. Thanks!

florissmit10 commented 3 years ago

I get the same error. Is there a way to enable stacktraces? I piped the deployment file in jq, and its valid json.

florissmit10 commented 3 years ago

I also found a difference in the different json files. Maybe this causes it?

(base) root@:/mnt/c/Users//src/iotedge.fscmodule# file deployment.template.json
deployment.template.json: ASCII text
(base) root@:/mnt/c/Users//src/iotedge.fscmodule# file config/deployment.amd64.json
config/deployment.amd64.json: JSON data

If I can find the cause im willing to submit a PR with a fix

cindydeng1998 commented 3 years ago

@florissmit10 Thank you for letting us now about this issue, we will investigate and get back to you. Thanks!

konichi3 commented 3 years ago

Hi @florissmit10

Does the issue reproduce with the WSL 18.04 instead of 20.04? Could you also share us the deployment.template.json for us to reproduce in house?

thanks!

konichi3 commented 3 years ago

Hi @florissmit10

I have tried to repro with the clean installation of Ubuntu 20.04 (WSL) running on Windows 11. I could not repro the issue and deploying edge module works just fine. Please see command output below.

If you can share us your deployment manifest, we can take further look.

****Pushing module PUSH COMPLETE

Expanding image placeholders Converting createOptions Deleting template schema version Expanding 'deployment.debug.template.json' to 'config/deployment.debug.amd64.json' Validating generated deployment manifest config/deployment.debug.amd64.json Validating schema of deployment manifest. Deployment manifest schema validation passed. Start validating createOptions for all modules. Validating createOptions for module tempSensor createOptions of module tempSensor validation passed Validating createOptions for module filtermodule createOptions of module filtermodule validation passed Validating createOptions for module edgeAgent createOptions of module edgeAgent validation passed Validating createOptions for module edgeHub createOptions of module edgeHub validation passed Validation for all createOptions passed.

****Deploying module

iotedgedev@6efb076b2c4a:/home/iotedge$ sudo iotedgedev deploy -f config/deployment.debug.amd64.json

======================================= ======== ENVIRONMENT VARIABLES ========

Environment Variables loaded from: .env (/home/iotedge/.env)

========================================= ======== DEPLOYING CONFIGURATION ========

Deploying 'config/deployment.debug.amd64.json' to 'iotedgedev-edgedevice'...

DEPLOYMENT COMPLETE

iotedgedev@6efb076b2c4a:/home/iotedge$

marianan commented 3 years ago

We are closing this issue as no repro at this time. Please feel free to reopen or file a new issue if the symptoms persist.