Fix Payment Gateway Propagation
Redeploy Gateway Fix
Rebuild and Redeploy After Saving #
Note
Saving
server.js does not update running pods until you rebuild and restart.bash
cd ~/workshop/context-propagation
bash scripts/build-images.sh payment-gateway
bash scripts/import-images-k3d.sh payment-gateway
kubectl -n cosmic-shop rollout restart deployment/payment-gateway
kubectl -n cosmic-shop rollout status deployment/payment-gateway --timeout=180sValidation Checklist #
Run these commands after redeploy completes.
1. Confirm health endpoint reports propagation #
bash
kubectl -n cosmic-shop exec deploy/payment-gateway -- wget -qO- http://localhost:3004/healthjson
{"status":"ok","service":"payment-gateway","stage":"proxy","propagation":true}The health check probes whether buildUpstreamHeaders() adds a traceparent header when a span is active - it flips to true automatically once you add propagation.inject().
2. Place a test order and inspect traces #
bash
curl -s -X POST http://localhost:30080/api/purchases \
-H "Content-Type: application/json" \
-d '{"productId":"telescope-orion-8","quantity":1,"customerEmail":"gateway-test@cosmic.shop"}' \
| python3 -m json.tooljson
{
"message": "Purchase complete \u2014 order placed and payment submitted for fulfillment",
"order": {
"orderId": "ORD-1783667419611",
"productId": "telescope-orion-8",
"productName": "Orion 8\" Dobsonian Telescope",
"quantity": 1,
"total": 449.99,
"customerEmail": "gateway-test@cosmic.shop",
"createdAt": "2026-07-10T07:10:19.611Z",
"requestTraceId": "6891d2d87734d4959214491bb2c600af"
},
"payment": {
"paymentId": "PAY-1783667419703",
"orderId": "ORD-1783667419611",
"amount": 449.99,
"status": "authorized",
"method": "stellar-credits",
"processedAt": "2026-07-10T07:10:19.703Z"
}
}Note
This workshop uses a Node.js proxy so you practice application-layer propagation bugs (common in BFFs and custom gateways). The NGINX ConfigMap approach from Step 06 applies when the break is at the infrastructure proxy layer instead.
