bitwarden / server

Bitwarden infrastructure/backend (API, database, Docker, etc).
https://bitwarden.com
Other
15.47k stars 1.31k forks source link

Can't upload new license : error 500 in Billing > Subscription #3929

Closed BeWog closed 6 months ago

BeWog commented 6 months ago

Steps To Reproduce

  1. Go to self-hosted instance
  2. Click on 'Admin Console'
  3. Then, go to 'Billing' > 'Subscription'

Expected Result

Webpage.

Actual Result

Loading spinner, nothing more. 500 error page.

Screenshots or Videos

bitwarden

Additional Context

From log : bwdata/logs/api/Api/20240327.txt

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.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.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at Bit.Core.Services.LicensingService.ReadOrganizationLicenseAsync(Guid organizationId) in /home/runner/work/server/server/src/Core/Services/Implementations/LicensingService.cs:line 273
   at Bit.Api.AdminConsole.Controllers.OrganizationsController.GetSubscription(String id) in /home/runner/work/server/server/src/Api/AdminConsole/Controllers/OrganizationsController.cs:line 195
   at lambda_method103(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   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|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Build Version

bitwarden.sh version 2024.3.0 Docker version 26.0.0, build 2ae903e Docker Compose version v2.25.0

Environment

Self-Hosted

Environment Details

No response

Issue Tracking Info

NovaSilentium commented 6 months ago

Hi there!

We've seen error messages similar to this in the past, and the issue was caused by the way the license was ingested into the database. In order to reset this, we need to move/rename the license file out of its current location on the self-hosted server, and then upload the license file again via the Web Vault:

SSH into the machine(s) and navigate to ./bwdata/core/licenses/organization

You should see at least one *.json file containing the license information; move this file to a temporary location

Log in through the Web Vault as an Owner, navigate to the Organization's page and then Billing → Subscription

Upload your license file again

Further to that, We use GitHub issues as a place to track bugs and other development related issues. If your issue persists, please write us back using our “Contact support” form located on our Help Center (https://bitwarden.com/help/).

You can include a link to this issue in the message content.

Alternatively, you can also search for an answer in our help documentation or get help from other Bitwarden users on our community forums (https://community.bitwarden.com/c/support/).

The issue here will be closed.

Thanks!

BeWog commented 6 months ago

It works. 👍

Thanks a lot.