nil pointer error in device-sdk-go when I run device-mqtt-go #166
-
seems like some "Client" communicate with ”core-metadata“ wasn't find in DI container,so I add these code to device-sdk-go,and device-mqtt-go service run well,without these code,the service throws nil pointer error。But,I don‘t think adding code to device-sdk-go is the right way,how can I solve this nil pointer error? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
All the core-metadata clients are in the DI. You don't need to modify any code. See the usage example: |
Beta Was this translation helpful? Give feedback.
-
The location where the clients are SUPPOSED to be pre-created in the DI is: https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/bootstrap/handlers/clients.go |
Beta Was this translation helpful? Give feedback.
-
@cglin7 , I assume you are running Device MQTT from command line in hybrid mode (other services running in docker). Also note that the handling of error cause by missing common configuration have been improved for the upcoming 3.1 release on the main branch. |
Beta Was this translation helpful? Give feedback.
@cglin7 , I assume you are running Device MQTT from command line in hybrid mode (other services running in docker).
If so, in 3.0 you need to provide the command line flags to let the service know where to get the common config (contains client config).
Please see this documentation for details: https://docs.edgexfoundry.org/3.0/getting-started/Ch-GettingStartedHybrid/#run-the-service-code-natively
Also note that the handling of error cause by missing common configuration have been improved for the upcoming 3.1 release on the main branch.