dev.villamarket.net
The staging storefront. Password-protected with Staticrypt: feature@villamarket.net.
| Value | |
|---|---|
| CloudFront | E200VHSCVLY8TL |
| Origin bucket | s3://dev.villamarket.net |
| Account | default / 394922924679 |
| Built from | villaEcommerceWeb 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:
- CloudFront —
aws cloudfront create-invalidation --paths '/*' - 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.
- 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.
| Path | Origin | Notes |
|---|---|---|
/api/calculatePrice/calculateCost2* | vn0mqj906d | calculatecost2 dev |
/api/calculatePrice/getCost* | vn0mqj906d | same |
/api/calculatePrice/* | 410u70d13m | legacy 2021 calculator — anything not routed above lands here |
/api/coupon2/couponChecker* | qe1hv09c68 | villacoupon3 dev |
/api/coupon2/* | yirihp7x0i | legacy coupon2 |
/api/polygon/* | 4x2xz1tybj | PolygonCost, 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.
| File | Patch |
|---|---|
js/app~0e6551fc.875fa3bb.js | delivery endpoint → /api/polygon/getPolygonCost; cost endpoint → ba+"/calculateCost2" |
js/chunk-1115a38c.b1c795f4.js | checkout Discount line includes two4Discount + specificSkuDiscount |
js/chunk-vendors~e1ee825c.91c64fe0.js | same 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.