Azure / iotedgehubdev

IoT Edge Hub Dev Tool
Other
87 stars 30 forks source link

iotedgehubdev won't start, error 400 ArgumentInvalid #180

Closed nonoxp closed 5 years ago

nonoxp commented 5 years ago

I don't know if this is correlated but since the VS2017 extension 0.3.1 was automatically applied I can't use the Debug feature anymore. I ensured my iotedgehubdev was version 0.7.0 and it just won't start, keep throwing me a code 400 error.

I tried to rollback to the previous version I had of the Extension for VS2017 (for which I was definitely using the debug feature a couple of weeks ago), but the same problem keeps coming. I tried uninstall the iotedgehubdev package, reinstall it to different versions I know were working, same result. Launching it by hand, with Admin permissions, same result.

Other people I work with use the same extension feature version, and they have no problem with the iotedgehubdev starting so I suspect a local problem with just my environment.

Can you please help me troubleshoot the cause of this error (what logs to check)?

Here's what I get now with an Edge project created with the VS2017 0.3.1 extension feature (brand new project, no customization, out of box project with one C# module).

Edge project debug (output window/Build): iotedgehubdev start -d "C:\edgetest\AzureIotEdgeApp120190315\AzureIotEdgeApp1.Linux.Amd64\config\deployment_for_local_debug.json" ERROR: (400, '{"Message":"ErrorCode:ArgumentInvalid;BadRequest","ExceptionMessage":"Tracking ID:bd5f187ab2084b3eade309521849a2f5-G:9-TimeStamp:03/15/2019 01:58:18"}') C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : PLEASE FIRST MAKE SURE iotedgehubdev HAS BEEN INSTALLED, THEN TRY AGAIN. C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : Failed to run 'iotedgehubdev start -d "C:\edgetest\AzureIotEdgeApp120190315\AzureIotEdgeApp1.Linux.Amd64\config\deployment_for_local_debug.json"' with error : C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.Azure.IoT.Edge.Infrastructure.Utilities.CommandLineClientException: ERROR: (400, '{"Message":"ErrorCode:ArgumentInvalid;BadRequest","ExceptionMessage":"Tracking ID:bd5f187ab2084b3eade309521849a2f5-G:9-TimeStamp:03/15/2019 01:58:18"}') C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : --- End of inner exception stack trace --- C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at Microsoft.VisualStudio.Azure.IoT.Edge.BuildTasks.PrepareEdgeCliTask.<ExecuteCoreAsync>d__2.MoveNext() C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : ---> (Inner Exception #0) Microsoft.VisualStudio.Azure.IoT.Edge.Infrastructure.Utilities.CommandLineClientException: ERROR: (400, '{"Message":"ErrorCode:ArgumentInvalid;BadRequest","ExceptionMessage":"Tracking ID:bd5f187ab2084b3eade309521849a2f5-G:9-TimeStamp:03/15/2019 01:58:18"}')<--- C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : Failed to exec task with error System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.Azure.IoT.Edge.Infrastructure.Utilities.CommandLineClientException: ERROR: (400, '{"Message":"ErrorCode:ArgumentInvalid;BadRequest","ExceptionMessage":"Tracking ID:bd5f187ab2084b3eade309521849a2f5-G:9-TimeStamp:03/15/2019 01:58:18"}') C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : --- End of inner exception stack trace --- C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at Microsoft.VisualStudio.Azure.IoT.Edge.BuildTasks.PrepareEdgeCliTask.<ExecuteCoreAsync>d__2.MoveNext() C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : --- End of stack trace from previous location where exception was thrown --- C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : at Microsoft.VisualStudio.Azure.IoT.Edge.BuildTasks.EdgeTaskBase.<ExecuteAsync>d__24.MoveNext() C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : ---> (Inner Exception #0) Microsoft.VisualStudio.Azure.IoT.Edge.Infrastructure.Utilities.CommandLineClientException: ERROR: (400, '{"Message":"ErrorCode:ArgumentInvalid;BadRequest","ExceptionMessage":"Tracking ID:bd5f187ab2084b3eade309521849a2f5-G:9-TimeStamp:03/15/2019 01:58:18"}')<--- C:\edgetest\AzureIotEdgeApp120190315\packages\Microsoft.VisualStudio.Azure.IoT.Edge.MSBuildTasks.0.3.0\build\AzureIoTEdgeProject.Build.targets(63,5): error : Done building project "AzureIotEdgeApp1.Linux.Amd64.iotedgeproj" -- FAILED.

Single module debug (output window/Build): IoT Hub edge module IotEdgeModule1 is using "input1" as inputs iotedgehubdev modulecred -l -m "target" EdgeHubConnectionString=HostName=***********.azure-devices.net;GatewayHostName=localhost;DeviceId=********;ModuleId=target;SharedAccessKey=************************************* EdgeModuleCACertificateFile=C:\ProgramData\iotedgehubdev\data\certs\edge-device-ca\cert\edge-device-ca.cert.pem iotedgehubdev start -i "input1" ERROR: (400, '{"Message":"ErrorCode:ArgumentInvalid;BadRequest","ExceptionMessage":"Tracking ID:f6150f7b6b6c41378453411a64680315-G:1-TimeStamp:03/15/2019 02:02:08"}')

erich-wang commented 5 years ago

@nonoxp , it looks like VS could not find iotedgehubdev, I suspect somehow the path of iotedgehubdev is not added into system environment variable Path.

  1. Have you restarted VS after installing iotedgehubdev?
  2. If yes for 1, please try to run "iotedgehubdev start" from your cmd and share the output here.
nonoxp commented 5 years ago

@erich-wang thanks for your suggestion, I overlooked it.

@nonoxp , it looks like VS could not find iotedgehubdev, I suspect somehow the path of iotedgehubdev is not added into system environment variable Path.

I have the following folder defined in my user's Path variable, this is where the iotedgehubdev.exe file is installed. C:\Users\[MyAccount]\apps\anaconda3\scripts But nothing of the sort defined in the System Path variable (adding it didn't change anything).

When launching directly from VS in the case of a single module debug, the command "iotedgehubdev modulecred" does not returns any error so I don't think this is a path problem.

  1. Have you restarted VS after installing iotedgehubdev?

yes a full system restart 2 or 3 times

  1. If yes for 1, please try to run "iotedgehubdev start" from your cmd and share the output here.

Sorry this is what I meant by "Launching it by hand". When I use directly cmd or powershell I can find iotedgehubdev.exe so its folder is already included in the Path variable.

nonoxp commented 5 years ago

After trying a lot of things on my environment I created a new IoT Hub instance. I have no idea why but setting the simulator with a connection string related to this Iot Hub did the trick. And I can now use iotedgehubdev as before.

erich-wang commented 5 years ago

@nonoxp , you probably used normal device connect string instead of edge device connection string when getting the error.

angellmethod commented 5 years ago

@erich-wang that suggestion resolved the issue I ran into