server icon indicating copy to clipboard operation
server copied to clipboard

Billing sync on Self-Hosted : Setting "Billing sync Token" fails with "An error has occurred. An unhandled server error has occurred."

Open fabieins opened this issue 3 years ago • 0 comments

Steps To Reproduce

  1. Complete steps on https://bitwarden.com/help/families-for-enterprise-self-hosted/
  2. Get errors like described in https://github.com/bitwarden/server/issues/2065
  3. get inspired by https://github.com/bitwarden/server/issues/2065#issuecomment-1160368744
  4. Delete "Billing sync Token" on the Self-Hosted instance
  5. Try to set new "Billing sync Token" on the Self-Hosted instance

Expected Result

  • working Billing sync
  • no message "Last Sync: never" under Organizations - Settings - Subscriptions - Billing Sync.

Actual Result

Get error message: "An error has occurred. An unhandled server error has occurred."

Screenshots or Videos

No response

Additional Context

/opt/bitwarden/bwdata/logs/api/Api/

[Error] 'K' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 33 | BytePositionInLine: 1.
System.Text.Json.JsonException: 'K' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 33 | BytePositionInLine: 1.
 ---> System.Text.Json.JsonReaderException: 'K' is invalid after a single JSON value. Expected end of data. LineNumber: 33 | BytePositionInLine: 1.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
   at Bit.Core.Services.LicensingService.ReadOrganizationLicenseAsync(Guid organizationId) in /home/runner/work/server/server/src/Core/Services/Implementations/LicensingService.cs:line 263
   at Bit.Api.Controllers.OrganizationConnectionsController.CreateConnection(OrganizationConnectionRequestModel model) in /home/runner/work/server/server/src/Api/Controllers/OrganizationConnectionsController.cs:line 76
   at lambda_method230(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

after Updating the License this Message change to:

 [Error] 'g' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 33 | BytePositionInLine: 1.
System.Text.Json.JsonException: 'g' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 33 | BytePositionInLine: 1.
 ---> System.Text.Json.JsonReaderException: 'g' is invalid after a single JSON value. Expected end of data. LineNumber: 33 | BytePositionInLine: 1.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
   at Bit.Core.Services.LicensingService.ReadOrganizationLicenseAsync(Guid organizationId) in /home/runner/work/server/server/src/Core/Services/Implementations/LicensingService.cs:line 263
   at Bit.Api.Controllers.OrganizationConnectionsController.CreateConnection(OrganizationConnectionRequestModel model) in /home/runner/work/server/server/src/Api/Controllers/OrganizationConnectionsController.cs:line 76
   at lambda_method163(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Build Version

2022.5.2

Environment

Self-Hosted

Environment Details

  • Operating system: CentOS 7.9.2009
  • Environment: Docker
  • Hardware: virtual (KVM), 2 cores, 4 GB RAM

fabieins avatar Jun 28 '22 10:06 fabieins