Search code examples
amazon-web-servicesamazon-rdsdatetimeoffsetsensenet

UTC offset error when installing the Sensenet Service package via SQL Server Authentication


For the last couple of days, I've been trying to install the sensenet service package via SQL Sever Authentication. Previously, I was able to successfully install the package through Windows Integrated Security but opted for SQL Server Authentication. Sensenet as of now only supports MS SQL databases and so that is what I went with. I created a free tier MS SQL database in AWS RDS without any preference of timezone, availability zone(us-east-1 but did not specify if I wanted 1a, 1b, 1c etc) and everything set to default. Reading from the docs, it says that by default it sets my timezone to be UTC and in my console, the created timezone for my db instance is GMT-400 . The timezone in my local machine is set to Eastern Standard Time(UTC-05:00). Now this is where the problem occurs.

After following the steps to install the service package and build the solution, I went to the bin folder to where the SnAdmin.exe is in, opened my command prompt in Administrator mode and typed this:

\snadmin install-services dataSource:some-amazon-endpoint.com initialCatalog:someDatabase 
username:usernameToLoginInServer password:passwordToLoginInServer dbusername:nameOfUserInSomeDatabase 
dbpassword:passwordOfUserInSomeDatabase

All of these variables are needed for SQL Server Authentication to be activated. This is the stacktrace that I got after entering execution phase 2.

ApplicationException: Phase terminated with error: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
   at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\63\s\src\ContentRepository\Packaging\PackageManager.cs:line 165
   at SenseNet.Packaging.PackageManager.Execute(String packagePath, String targetPath, Int32 currentPhase, String[] parameters, TextWriter console) in E:\BuildAgent\_work\63\s\src\ContentRepository\Packaging\PackageManager.cs:line 71
   at SenseNet.Tools.SnAdmin.SnAdminRuntime.ExecutePhase(String packagePath, String targetDirectory, Int32 phase, String[] parameters, String logFilePath, Boolean help, Boolean schema) in E:\BuildAgent\_work\63\s\src\Tools\SnAdminRuntime\SnAdminRuntime.cs:line 191
---- Inner Exception:
ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
   at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
   at System.DateTimeOffset..ctor(DateTime dateTime)
   at SenseNet.ContentRepository.Storage.Caching.SnMemoryCache.Insert(String key, Object value, CacheDependency dependencies) in E:\BuildAgent\_work\63\s\src\Storage\Caching\SnMemoryCache.cs:line 49
   at SenseNet.ContentRepository.Storage.DataBackingStore.CacheNodeHead(NodeHead head, String idKey, String pathKey) in E:\BuildAgent\_work\63\s\src\Storage\DataBackingStore.cs:line 136
   at SenseNet.ContentRepository.Storage.DataBackingStore.GetNodeHead(Int32 nodeId) in E:\BuildAgent\_work\63\s\src\Storage\DataBackingStore.cs:line 65
   at SenseNet.ContentRepository.User.get_Administrator() in E:\BuildAgent\_work\63\s\src\ContentRepository\User.cs:line 47
   at SenseNet.ContentRepository.Security.DesktopAccessProvider.get_CurrentUser() in E:\BuildAgent\_work\63\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 36
   at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\63\s\src\Storage\Security\AccessProvider.cs:line 45
   at SenseNet.ContentRepository.Security.DesktopAccessProvider.GetCurrentUser() in E:\BuildAgent\_work\63\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 52
   at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\63\s\src\Storage\Security\AccessProvider.cs:line 45
   at SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:\BuildAgent\_work\63\s\src\ContentRepository\RepositoryInstance.cs:line 141
   at SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\63\s\src\ContentRepository\RepositoryInstance.cs:line 107
   at SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\63\s\src\ContentRepository\Repository.cs:line 55
   at SenseNet.Packaging.Steps.StartRepository.Execute(ExecutionContext context) in E:\BuildAgent\_work\63\s\src\ContentRepository\Packaging\Steps\StartRepository.cs:line 55
   at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\63\s\src\ContentRepository\Packaging\PackageManager.cs:line 112

===============================================================================
SnAdmin stopped with error.

Quick Workaround

Changing the local time zone in my machine to UTC got rid of the error. This is not ideal because I would like it to use the correct timezone that my machine automatically applies. I'm just confused as to why it fails when my timezone is EST as I'm not sure if this has to do with sensenet or AWS itself. Any help will be greatly appreciated.


Solution

  • We think the issue was that we used the incorrect DateTime max value when inserting an object to the cache. The fix is already published in version 7.4.1 where we use the DateTimeOffset max value.