openchargemap / ocm-system

Open Charge Map is the global public registry of electric vehicle charging locations. Established 2011. Help wanted.
https://openchargemap.org
MIT License
101 stars 33 forks source link

POI Update failed::System.NullReferenceException: Object reference not set to an instance of an object #190

Closed mrw298 closed 2 years ago

mrw298 commented 2 years ago

Mirroring seems to fail because of some null / string comparisons in CacheProviderMongoDB.cs

ocm-mirror-app {"EventId":0,"LogLevel":"Information","Category":"OCM.API.Worker.Worker","Message":"POI Update failed::System.NullReferenceException: Object reference not set to an instance of an object.\n at OCM.Core.Data.CacheProviderMongoDB.PopulatePOIMirror(CacheUpdateStrategy updateStrategy, ILogger logger) in /src/API/OCM.Net/OCM.API.Core/Util/CacheProviderMongoDB.cs:line 584\n at OCM.Core.Data.CacheManager.RefreshCachedData(CacheUpdateStrategy updateStrategy, ILogger logger) in /src/API/OCM.Net/OCM.API.Core/Util/CacheManager.cs:line 69","State":{"Message":"POI Update failed::System.NullReferenceException: Object reference not set to an instance of an object.\n at OCM.Core.Data.CacheProviderMongoDB.PopulatePOIMirror(CacheUpdateStrategy updateStrategy, ILogger logger) in /src/API/OCM.Net/OCM.API.Core/Util/CacheProviderMongoDB.cs:line 584\n at OCM.Core.Data.CacheManager.RefreshCachedData(CacheUpdateStrategy updateStrategy, ILogger logger) in /src/API/OCM.Net/OCM.API.Core/Util/CacheManager.cs:line 69","{OriginalFormat}":"POI Update failed::System.NullReferenceException: Object reference not set to an instance of an object.\n at OCM.Core.Data.CacheProviderMongoDB.PopulatePOIMirror(CacheUpdateStrategy updateStrategy, ILogger logger) in /src/API/OCM.Net/OCM.API.Core/Util/CacheProviderMongoDB.cs:line 584\n at OCM.Core.Data.CacheManager.RefreshCachedData(CacheUpdateStrategy updateStrategy, ILogger logger) in /src/API/OCM.Net/OCM.API.Core/Util/CacheManager.cs:line 69"}}

I'm not much of a C# developer so there's probably a better way to do this, but this seems to get it syncing if you want a PR

https://github.com/mrw298/ocm-system/commit/ea9c12714bfe540393c8e02511daccc60f0ad593

webprofusion-chrisc commented 2 years ago

Hi, yes go ahead an submit a PR please, we haven't been using the mirroring recently while we are on temporary servers so that's probably why it hasn't been a problem for us.

mrw298 commented 2 years ago

The PR is #191, please let me know if you want any changes.