dev.villamarket.net

The staging storefront. Password-protected with Staticrypt: feature@villamarket.net.

Value
CloudFrontE200VHSCVLY8TL
Origin buckets3://dev.villamarket.net
Accountdefault / 394922924679
Built fromvillaEcommerceWeb branch feature

Read this before believing “the fix isn’t there”

Three layers cache the frontend, and they must all be cleared for a change to reach a tester:

  1. CloudFrontaws cloudfront create-invalidation --paths '/*'
  2. The service worker precache — a Workbox manifest pinning each asset to a revision hash. If the revision doesn’t change, the worker keeps serving the old file even after a CloudFront invalidation and a hard refresh.
  3. The browser HTTP cache — a normal hard refresh handles this.

Layer 2 is the one that burns people. A verified-correct file in S3 plus a completed invalidation still leaves testers on the old bundle. patch-dev-web-bundle covers doing this properly.

After any frontend change, tell testers to hard refresh once. Until the new service worker installs they are running old code.

API routing

CloudFront maps path prefixes to different API Gateways. Order matters — more specific patterns are matched first.

PathOriginNotes
/api/calculatePrice/calculateCost2*vn0mqj906dcalculatecost2 dev
/api/calculatePrice/getCost*vn0mqj906dsame
/api/calculatePrice/*410u70d13mlegacy 2021 calculator — anything not routed above lands here
/api/coupon2/couponChecker*qe1hv09c68villacoupon3 dev
/api/coupon2/*yirihp7x0ilegacy coupon2
/api/polygon/*4x2xz1tybjPolygonCost, decides Regular vs Nationwide

The catch-all /api/calculatePrice/* is a trap: a new endpoint silently goes to the 2021 calculator until someone adds a specific behavior for it. That is how getCost ended up bypassing the new calculator entirely.

Authentication

The viewer-request function requires a bearer token on /api/*:

APIKEY=$(python3 -c 'import json,boto3; r=boto3.Session(profile_name="default").client("lambda","ap-southeast-1").invoke(FunctionName="get-apikey-master",Payload=b"{}"); print(json.loads(json.loads(r["Payload"].read())["body"])["key"])')
curl -H "Authorization: Bearer $APIKEY" ...

An apikey: header is not accepted; it returns authorization doesnt exist or authorization is the wrong format.

Live patches not in git

The deployed dev bundle currently carries hot-patches applied directly to S3. The next web deploy overwrites them. They exist because the permanent fixes are still in review as villaEcommerceWeb#315.

FilePatch
js/app~0e6551fc.875fa3bb.jsdelivery endpoint → /api/polygon/getPolygonCost; cost endpoint → ba+"/calculateCost2"
js/chunk-1115a38c.b1c795f4.jscheckout Discount line includes two4Discount + specificSkuDiscount
js/chunk-vendors~e1ee825c.91c64fe0.jssame for the cart

Once #315 merges and deploys, delete this section.

Known flakiness unrelated to your change

/api/promotion/get-two4 returns 504 intermittently and stalls the cart on a spinner. Reload; it usually loads on the second attempt.