- ABP Framework version: v8.2.2
- UI Type: Angular
- Database System: EF Core SQL Server
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
- Exception message and full stack trace:
System.Collections.Generic.KeyNotFoundException:
at System.ThrowHelper.ThrowKeyNotFoundException (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Collections.Generic.Dictionary`2.get_Item (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Payment.Stripe.StripePaymentGateway+<HandleWebhookAsync>d__25.MoveNext (Volo.Payment.Stripe.Domain, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Payment.Requests.PaymentRequestAppService+<HandleWebhookAsync>d__14.MoveNext (Volo.Payment.Application, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Castle.DynamicProxy.AsyncInterceptorBase+<ProceedAsynchronous>d__14`1.MoveNext (Castle.Core.AsyncInterceptor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e33b67d3bb5581e4)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1+<ProceedAsync>d__7.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor+<InterceptAsync>d__0.MoveNext (Volo.Abp.GlobalFeatures, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1+<InterceptAsync>d__3`1.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Castle.DynamicProxy.AsyncInterceptorBase+<ProceedAsynchronous>d__14`1.MoveNext (Castle.Core.AsyncInterceptor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e33b67d3bb5581e4)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1+<ProceedAsync>d__7.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Auditing.AuditingInterceptor+<ProceedByLoggingAsync>d__4.MoveNext (Volo.Abp.Auditing, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Auditing.AuditingInterceptor+<InterceptAsync>d__2.MoveNext (Volo.Abp.Auditing, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1+<InterceptAsync>d__3`1.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Castle.DynamicProxy.AsyncInterceptorBase+<ProceedAsynchronous>d__14`1.MoveNext (Castle.Core.AsyncInterceptor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e33b67d3bb5581e4)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1+<ProceedAsync>d__7.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Validation.ValidationInterceptor+<InterceptAsync>d__2.MoveNext (Volo.Abp.Validation, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1+<InterceptAsync>d__3`1.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Castle.DynamicProxy.AsyncInterceptorBase+<ProceedAsynchronous>d__14`1.MoveNext (Castle.Core.AsyncInterceptor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e33b67d3bb5581e4)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1+<ProceedAsync>d__7.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Uow.UnitOfWorkInterceptor+<InterceptAsync>d__2.MoveNext (Volo.Abp.Uow, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1+<InterceptAsync>d__3`1.MoveNext (Volo.Abp.Castle.Core, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Payment.Requests.PaymentRequestController+<HandleWebhookAsync>d__7.MoveNext (Volo.Payment.HttpApi, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at lambda_method3157 (Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+AwaitableObjectResultExecutor+<Execute>d__0.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.ValueTask`1.get_Result (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Awaited|12_0>d.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeNextActionFilterAsync>g__Awaited|10_0>d.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeNextExceptionFilterAsync>g__Awaited|26_0>d.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
- Steps to reproduce the issue: It's working fine locally, but after deploying to Azure (Azure Container Apps), the Stripe webhook could not be triggered. I have those credentials in appSetting.json
"Payment": {
"Stripe": {
"PublishableKey": "pk_test_xxxx",
"SecretKey": "sk_test_xxx",
"WebhookSecret": "whsec_xxx"
}
},
5 Answer(s)
-
0
I have Application Gateway (WAF_v2) in front of the API (webhook), even I disabled the Web Application Firewall, the issue still happened.
Problem Id System.Collections.Generic.KeyNotFoundException at Volo.Payment.Stripe.StripePaymentGateway+<HandleWebhookAsync>d__25.MoveNext Assembly Volo.Payment.Stripe.Domain, Version=8.2.2.0, Culture=neutral, PublicKeyToken=null ActionId 46ab5810-8ae3-4668-88ec-1dc6eb213d2b ConnectionId 0HN7NVU4BKI1E MessageTemplate The given key 'Stripe-Signature' was not present in the dictionary. RequestId 0HN7NVU4BKI1E:00000006 SourceContext Volo.Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter RequestPath /api/payment/stripe/webhook ActionName Volo.Payment.Requests.PaymentRequestController.HandleWebhookAsync (Volo.Payment.HttpApi)
It's similar to https://abp.io/support/questions/4386/Error-from-ABP-commercial-payments-module-stripe-webhook-callback-handling-bug#answer-df4c481c-cbb9-299f-b150-3a08fa8e68da, but it has been resolved 2 years ago, I am wondering how comes the key was missing in the header.
I have double checked the secrets, they are correct.
-
0
Is the header key case sensitive? I captured the header in the request, its lower case.
"stripe-signature": [ "t=1730242133,v1=decaaca94f84b9e6c0523c2f283945f52a8a2e6ce0ab654bade8aa51dc2a98a5,v0=08b2da9f09b998a63e483b36ee2cf7325769eeb650ab665ed42f3e14f4cfc69a" ],
-
0
hi
I think it is case-sensitive. You can try to override the
StripePaymentGateway
to make it case-insensitive.typeof(StripePaymentGateway)
public override void ConfigureServices(ServiceConfigurationContext context) { Configure<PaymentOptions>(options => { options.Gateways.Add( new PaymentGatewayConfiguration( StripeConsts.GatewayName, new FixedLocalizableString("Stripe"), isSubscriptionSupported: true, typeof(StripePaymentGateway) ) ); }); }
We will fix it in the next version.
Thanks.
-
0
Welcome back maliming, thanks for your reply.
I have resolved this issue referring to the others reply, similar to yours but ExposeService.
[ExposeServices(typeof(StripePaymentGateway))] public class CustomStripeGateway : StripePaymentGateway { public CustomStripeGateway( IPaymentRequestRepository paymentRequestRepository, IPurchaseParameterListGenerator purchaseParameterListGenerator, IPlanRepository planRepository, IOptions<StripeOptions> stripeOptions, ILogger<StripePaymentGateway> logger, IDistributedEventBus eventBus, IObjectMapper objectMapper ) : base( paymentRequestRepository, purchaseParameterListGenerator, planRepository, stripeOptions, logger, eventBus, objectMapper ) { } public override Task HandleWebhookAsync(string payload, Dictionary<string, string> headers) { if (!headers.ContainsKey("Stripe-Signature") && headers.ContainsKey("stripe-signature")) { headers["Stripe-Signature"] = headers["stripe-signature"]; headers.Remove("stripe-signature"); // Log the information Logger.LogInformation("Stripe-Signature header was missing, but stripe-signature was present. Converted stripe-signature to Stripe-Signature."); } // Volo Stripe Payment expects Stripe-Signature in the headers return base.HandleWebhookAsync(payload, headers); } }
-
0