Azure-Samples / web-apps-node-iot-hub-data-visualization

web application for visualization data from IoT Hub
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-live-data-visualization-in-web-apps
MIT License
83 stars 433 forks source link

Error: Cannot read property 'createFromIotHubConnectionString' of undefined #42

Closed Hasnni closed 4 years ago

Hasnni commented 4 years ago

Cannot read property 'createFromIotHubConnectionString' of undefined Listening on 1337.

i did all steps as explained in documents.

drwill-ms commented 4 years ago

Hi Hasnni -

How are you setting environment variables and starting npm?

What I've found is if you use VSCode and the launch.json with F5 to debug, it works. However, if you type npm start then the variables must be set in the console.

Hasnni commented 4 years ago

I tried both way but still getting same error

drwill-ms commented 4 years ago

@Hasni what time zone are you in? Would you be open to a Teams meeting and screen share to troubleshoot?

Hasnni commented 4 years ago

iam trying to build client side with c# now

drwill-ms commented 4 years ago

Okay.

The error you were getting with node just means the environment variable for the hub connection string isn't being loaded. If you come back to this sample and would like some help troubleshooting, I'd be happy to arrange a time with you. Let me know! :)

Sambitk commented 4 years ago

I am facing a similar issue while following: https://docs.microsoft.com/en-us/learn/modules/remotely-monitor-devices-with-azure-iot-hub/4-exercise-write-code-device-telemetry?pivots=vscode-node

Issue is while executing the service code. I have done the following apart from the mentioned when it didn't work:

  1. npm install azure-event-hubs
  2. npm install @azure/event-hubs
drwill-ms commented 4 years ago

@Sambitk, this repo sample uses a dramatically different version of the EventHub client than the one you linked (major versioned and different constructor paradigm).

You can ask for help on that sample at https://docs.microsoft.com/en-us/learn/support/.