Describe the bug
LNbank wallet can not create invoices.
To Reproduce the bug
Steps to reproduce the reported bug:
Install LNbank
Create wallet and configure it for store
Try to pay
See there is no BOLT invoice, just LNURL payment method
Select LNURL method and see 400 Bad Request
Expected behavior
There will be BOLT11 method and LNURL method will work.
Screenshots
Your BTCPay Environment (please complete the following information):
BTCPay Server Version: v1.4.1.0
Deployment Method: Docker
Browser: Safari, Breez
Logs (if applicable)
stdout log:
Created BTCPay invoice
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMF1T51077DE", Request id "0HMF1T51077DE:00000003": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
at BTCPayServer.Security.Greenfield.GreenfieldAuthorizationHandler.HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement) in /source/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs:line 128
at Microsoft.AspNetCore.Authorization.AuthorizationHandler`1.HandleAsync(AuthorizationHandlerContext context)
at Microsoft.AspNetCore.Authorization.DefaultAuthorizationService.AuthorizeAsync(ClaimsPrincipal user, Object resource, IEnumerable`1 requirements)
at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CanUseInternalLightning(Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 271
at BTCPayServer.Controllers.Greenfield.GreenfieldInternalLightningNodeApiController.GetLightningClient(String cryptoCode, Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs:line 114
at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CreateInvoice(String cryptoCode, CreateLightningInvoiceRequest request) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 205
at BTCPayServer.Controllers.Greenfield.LocalBTCPayServerClient.CreateLightningInvoice(String cryptoCode, CreateLightningInvoiceRequest request, CancellationToken token) in /source/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs:line 463
at BTCPayServer.Plugins.LNbank.Services.BTCPayService.CreateLightningInvoice(String userId, LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/BTCPayService.cs:line 25
at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 102
at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 121
at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 92
at BTCPayServer.Plugins.LNbank.Controllers.API.LightningController.CreateLightningInvoice(LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Controllers/API/LightningController.cs:line 46
at lambda_method2513(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.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()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 100
at BTCPayServer.Hosting.GreenfieldMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/GreenfieldMiddleware.cs:line 50
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at BTCPayServer.Hosting.HeadersOverrideMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs:line 30
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
Tried to pay LNURL by Breez
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMF1T51077DE", Request id "0HMF1T51077DE:00000005": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
at BTCPayServer.Security.Greenfield.GreenfieldAuthorizationHandler.HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement) in /source/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs:line 128
at Microsoft.AspNetCore.Authorization.AuthorizationHandler`1.HandleAsync(AuthorizationHandlerContext context)
at Microsoft.AspNetCore.Authorization.DefaultAuthorizationService.AuthorizeAsync(ClaimsPrincipal user, Object resource, IEnumerable`1 requirements)
at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CanUseInternalLightning(Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 274
at BTCPayServer.Controllers.Greenfield.GreenfieldInternalLightningNodeApiController.GetLightningClient(String cryptoCode, Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs:line 119
at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CreateInvoice(String cryptoCode, CreateLightningInvoiceRequest request) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 205
at BTCPayServer.Controllers.Greenfield.LocalBTCPayServerClient.CreateLightningInvoice(String cryptoCode, CreateLightningInvoiceRequest request, CancellationToken token) in /source/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs:line 463
at BTCPayServer.Plugins.LNbank.Services.BTCPayService.CreateLightningInvoice(String userId, LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/BTCPayService.cs:line 25
at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 102
at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 121
at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, uint256 description) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 95
at BTCPayServer.Plugins.LNbank.Controllers.API.LightningController.CreateLightningInvoice(LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Controllers/API/LightningController.cs:line 42
at lambda_method2513(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.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()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 100
at BTCPayServer.Hosting.GreenfieldMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/GreenfieldMiddleware.cs:line 50
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at BTCPayServer.Hosting.HeadersOverrideMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs:line 30
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
Describe the bug LNbank wallet can not create invoices.
To Reproduce the bug Steps to reproduce the reported bug:
Expected behavior
There will be BOLT11 method and LNURL method will work.
Screenshots
Your BTCPay Environment (please complete the following information):
Logs (if applicable)
stdout log:
Created BTCPay invoice
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMF1T51077DE", Request id "0HMF1T51077DE:00000003": An unhandled exception was thrown by the application. System.NullReferenceException: Object reference not set to an instance of an object. at BTCPayServer.Security.Greenfield.GreenfieldAuthorizationHandler.HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement) in /source/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs:line 128 at Microsoft.AspNetCore.Authorization.AuthorizationHandler`1.HandleAsync(AuthorizationHandlerContext context) at Microsoft.AspNetCore.Authorization.DefaultAuthorizationService.AuthorizeAsync(ClaimsPrincipal user, Object resource, IEnumerable`1 requirements) at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CanUseInternalLightning(Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 271 at BTCPayServer.Controllers.Greenfield.GreenfieldInternalLightningNodeApiController.GetLightningClient(String cryptoCode, Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs:line 114 at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CreateInvoice(String cryptoCode, CreateLightningInvoiceRequest request) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 205 at BTCPayServer.Controllers.Greenfield.LocalBTCPayServerClient.CreateLightningInvoice(String cryptoCode, CreateLightningInvoiceRequest request, CancellationToken token) in /source/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs:line 463 at BTCPayServer.Plugins.LNbank.Services.BTCPayService.CreateLightningInvoice(String userId, LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/BTCPayService.cs:line 25 at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 102 at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 121 at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 92 at BTCPayServer.Plugins.LNbank.Controllers.API.LightningController.CreateLightningInvoice(LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Controllers/API/LightningController.cs:line 46 at lambda_method2513(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Tried to pay LNURL by Breez
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMF1T51077DE", Request id "0HMF1T51077DE:00000005": An unhandled exception was thrown by the application. System.NullReferenceException: Object reference not set to an instance of an object. at BTCPayServer.Security.Greenfield.GreenfieldAuthorizationHandler.HandleRequirementAsync(AuthorizationHandlerContext context, PolicyRequirement requirement) in /source/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs:line 128 at Microsoft.AspNetCore.Authorization.AuthorizationHandler`1.HandleAsync(AuthorizationHandlerContext context) at Microsoft.AspNetCore.Authorization.DefaultAuthorizationService.AuthorizeAsync(ClaimsPrincipal user, Object resource, IEnumerable`1 requirements) at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CanUseInternalLightning(Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 274 at BTCPayServer.Controllers.Greenfield.GreenfieldInternalLightningNodeApiController.GetLightningClient(String cryptoCode, Boolean doingAdminThings) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.Internal.cs:line 119 at BTCPayServer.Controllers.Greenfield.GreenfieldLightningNodeApiController.CreateInvoice(String cryptoCode, CreateLightningInvoiceRequest request) in /source/BTCPayServer/Controllers/GreenField/GreenfieldLightningNodeApiController.cs:line 205 at BTCPayServer.Controllers.Greenfield.LocalBTCPayServerClient.CreateLightningInvoice(String cryptoCode, CreateLightningInvoiceRequest request, CancellationToken token) in /source/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs:line 463 at BTCPayServer.Plugins.LNbank.Services.BTCPayService.CreateLightningInvoice(String userId, LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/BTCPayService.cs:line 25 at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 102 at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, String description, uint256 descriptionHash, TimeSpan expiry) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 121 at BTCPayServer.Plugins.LNbank.Services.Wallets.WalletService.Receive(Wallet wallet, Int64 amount, uint256 description) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Services/Wallets/WalletService.cs:line 95 at BTCPayServer.Plugins.LNbank.Controllers.API.LightningController.CreateLightningInvoice(LightningInvoiceCreateRequest req) in /home/d11n/Sources/btcpay/server/BTCPayServer.Plugins.LNbank/Controllers/API/LightningController.cs:line 42 at lambda_method2513(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.