Error Context Layer / checkout-api / production / inc_8f21c0
error
Null discount rule at checkout
TypeError Cannot read properties of null (reading 'percentOff')
- Status
- open
- Priority
- P1
- Events
- 184
- Capture
- complete
Context Timeline
Request entry, outbound I/O, local state records, and the throw frame.
1
Request entered the servicePOST /checkout/confirm
POST /checkout/confirm reached checkout-api in iad1.
requestId = req_demo_8f21c0capturedtraceId = d4a7e0b92c315f86a1c9e472b05d683fcaptured2
Request entered checkout
couponCode = "WELCOME10"captured3
Cart loadedCart load / postgres.carts / 1 row / 12ms /
cart.totalCents = 12600captured4
Discount lookup missedDiscount rule lookup / redis:discount:WELCOME10 / null / 4ms /
discountRule = nullcaptured5
Tax quote returnedTax quote / https://tax.internal/quote / 200 OK / 31ms /
taxCents = 1094captured6
Read percentOff on a null discountRule
const discountCents = Math.round(cart.totalCents * discountRule.percentOff);discountRule
src/checkout/discounts.ts:88:31nullcapturedRuntime evidence
Values, bound inputs, I/O records, and throw frame metadata.
Captured locals
discountRule
nullcapturedcouponCode = "WELCOME10" / discountRule = null / cart.totalCents = 12600 / customerTier = "standard"Origin I/O
Discount rule lookup
redis:discount:WELCOME10null / 4ms / missBound inputs
body.cartId = "cart_9e3a" / body.couponCode = "WELCOME10" / headers.x-request-id = "req_demo_8f21c0"Capture completenesscaptured locals / captured args / captured I/O41 KB package / encrypted yes
Trace path
POST /checkout/confirmDiscount rule lookup: nulldiscountRule = nullsrc/checkout/discounts.ts:88request / I/O / local / stackStack trace entry point
The stack identifies where Errorcore attached the context above; it is the entry point, not the full answer.
applyDiscountsrc/checkout/discounts.ts:88:31
const discountCents = Math.round(cart.totalCents * discountRule.percentOff);confirmCheckoutsrc/checkout/confirm.ts:141:18
handleRequestnode_modules/fastify/lib/handleRequest.js:103:11
Request context
LinePOST /checkout/confirmRequest IDreq_demo_8f21c0Status500Regioniad1RoutePOST /checkout/confirmBodyselected checkout keys capturedTraced4a7e0b92c315f86a1c9e472b05d683fSpan7f3a9c01d5e842b6 / parent b61f20c98a3d54e7
Runtime and I/O
Nodev22.14.0Hostiad-checkout-03Release2026.05.08-4f17c2SDK0.9.1Memoryrss 384 MB, heap 121 MBLoop lag17 ms
Cart load
ok12ms1 row
postgres.cartsDiscount rule lookup
miss4msnull
redis:discount:WELCOME10Tax quote
ok31ms200 OK
https://tax.internal/quoteCapture completeness
QualitycompleteLocalscapturedArgscapturedI/OcapturedEncryptedyesPayload41 KB
policy appliedpayload 41 KB