Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 IoT Edge module container Image expecting IOTEDGE_WORKLOADURI enviorment variable #584

Closed
prashbv opened this issue Nov 29, 2018 · 6 comments

Comments

@prashbv
Copy link

prashbv commented Nov 29, 2018

Error 500 at IoT Edge module

The container Image expecting IOTEDGE_WORKLOADURI enviorment variable when trying to run the application in debug mode.

[Module] Module info: {
"moduleId": "WinUDPListener",
"managedBy": "IotEdge",
"deviceId": "vm-win10-edge",
"generationId": "636790063927487363",
"etag": "NjE0NzI1NjM2",
"connectionState": "Disconnected",
"connectionStateUpdatedTime": "0001-01-01T00:00:00",
"lastActivityTime": "0001-01-01T00:00:00",
"cloudToDeviceMessageCount": 0,

Connection State is also disconnected. When tried running the module at the edge runtime envionment using powershell

Unhandled Exception: System.AggregateException: One or more errors occurred. (Environment variable IOTEDGE_WORKLOADURI is required.) ---> System.InvalidOperationException: Environment variable IOTEDGE_WORKLOADURI is required.
at Microsoft.Azure.Devices.Client.Edge.EdgeModuleClientFactory.CreateInternalClientFromEnvironmentAsync()
at UdpListenerModule.Program.Init() in C:\app\Program.cs:line 53
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at UdpListenerModule.Program.Main(String[] args) in C:\app\Program.cs:line 27

Appreciate your help as setting IOTEDGE_WORKLOADURI environment variable didnt make any difference.

image

image

@myagley
Copy link
Contributor

myagley commented Nov 30, 2018

Can you please provide a little more detail around your scenario? Are these modules being started outside of the context of the IoT Edge? This environment variable is set by the Edge Agent when starting the containers.

@prashbv
Copy link
Author

prashbv commented Dec 4, 2018

Hello Mike,

Thanks for your time in reading out this issue. These Iot edge modules are a customer one built in C# and deployed into the edge runtime both onprem and VM hosted in cloud.

I am not getting the 500 error now and the module is also running. But during its runtime its not able to get the environment variable IOTEDGE_WORKLOADURI although its been configured at the .env file and as well at the within module environment variables section at the azure portal.

image

Appreciate if you have any advise.

@myagley
Copy link
Contributor

myagley commented Dec 4, 2018

This environment variable (IOTEDGE_WORKLOADURI) is set by the runtime itself. It shouldn't need to be set explicitly via the .env file or in the portal.

What version of iotedge is running? You can run iotedge version in the terminal to get the version number.

@prashbv
Copy link
Author

prashbv commented Dec 10, 2018

ISSUE RESOLVED.
For a custom application like C# edge module in my case IOTEDGE_WORKLOADURI i had to configure it into the CreateOptions section which i did earlier but failed due to syntax issues.

Upon defining Createoptions section with required environment variables into deployment template file pushed these into the edge solution config file and was able to be picked up during runtime.

Likewise the same can be configured at the ARM portal within the module when you select through Set Module option.

However the text boxes given to input envionment variables wasnt really working well and i did stay away from that option as working through the application config file was much easier.

Thankyou for your time. Cheers!

@RotateAt60MPH
Copy link

RotateAt60MPH commented Jan 12, 2020

@prashbv How about some additional detail on how/where you solved this? Which file/section and what did you set it to??

@cdjc
Copy link

cdjc commented Jun 24, 2020

I solved this by adding:

<ItemGroup>
  <ProjectCapability Include="AzureIoTEdgeModule" />
</ItemGroup>

to the .csproj file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants