From c27a9ea80568dd340a5932a17a8af6a2b9e3105b Mon Sep 17 00:00:00 2001 From: Serge RAKOTO HARRY-NAIVO Date: Thu, 7 May 2026 14:25:25 +0200 Subject: [PATCH] chore(worker): wire up real KV ID + workers_dev=true + harden getNextRef - wrangler.toml: workers_dev=true (= explicit routing on *.workers.dev) - wrangler.toml: real KV ID c02656ba2206... after `wrangler kv namespace create WELCOME_KV` - hubspot-proxy.js getNextRef: guard `!res.ok` before res.json() to surface HubSpot errors - .gitignore: ignore .wrangler/ local cache dir Discovered during Phase D2-D3 deploy + smoke testing. Refs: WordPress \xe2\x86\x92 static migration plan, Phase B PR #3a. --- cloudflare-worker/.gitignore | 1 + cloudflare-worker/hubspot-proxy.js | 3 +++ cloudflare-worker/wrangler.toml | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 cloudflare-worker/.gitignore diff --git a/cloudflare-worker/.gitignore b/cloudflare-worker/.gitignore new file mode 100644 index 0000000..b75a0fa --- /dev/null +++ b/cloudflare-worker/.gitignore @@ -0,0 +1 @@ +.wrangler/ diff --git a/cloudflare-worker/hubspot-proxy.js b/cloudflare-worker/hubspot-proxy.js index c6610bc..c3a9bcb 100644 --- a/cloudflare-worker/hubspot-proxy.js +++ b/cloudflare-worker/hubspot-proxy.js @@ -297,6 +297,9 @@ async function getNextRef(token) { limit: 100, }), }); + if (!res.ok) { + throw new Error(`HubSpot search failed: ${res.status}`); + } const data = await res.json(); let maxNum = 0; (data.results || []).forEach(c => { diff --git a/cloudflare-worker/wrangler.toml b/cloudflare-worker/wrangler.toml index 79b64ea..c385fb7 100644 --- a/cloudflare-worker/wrangler.toml +++ b/cloudflare-worker/wrangler.toml @@ -1,11 +1,12 @@ name = "mva-hubspot-proxy" main = "hubspot-proxy.js" compatibility_date = "2026-04-01" +workers_dev = true # KV namespace — placeholder ID, populated at deploy time (Phase D3) [[kv_namespaces]] binding = "WELCOME_KV" -id = "REPLACE_AT_DEPLOY_TIME" +id = "c02656ba22064923ab1c6db06b0f4a56" # Required secrets to configure via `wrangler secret put` : # - HUBSPOT_TOKEN