← back to Site Factory
wholivedthere.com: ship live GA4 + fix audit-trail postJSON
fa82160281419a0995c2409c5957c016397316c9 · 2026-05-19 21:52:37 -0700 · SteveStudio2
* sites/wholivedthere.com/app/lib/gtag.js — measurement id G-VV80JM88WB
(GA4 property 538258118, created via stage 8 `/analytics` skill)
* stages/runners.js — postJSON to /actions and /findings now forwards
the orchestrator's BASIC_AUTH credential. Was silently 401'ing every
audit-trail write (req.on('error') swallowed it), so site 1's first
full pipeline pass landed 0 rows in actions_log. Smoke-tested by
re-running stage 0: actions_log went 0 → 1 with the expected row.
Files touched
A sites/wholivedthere.com/app/lib/gtag.jsM stages/runners.js
Diff
commit fa82160281419a0995c2409c5957c016397316c9
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Tue May 19 21:52:37 2026 -0700
wholivedthere.com: ship live GA4 + fix audit-trail postJSON
* sites/wholivedthere.com/app/lib/gtag.js — measurement id G-VV80JM88WB
(GA4 property 538258118, created via stage 8 `/analytics` skill)
* stages/runners.js — postJSON to /actions and /findings now forwards
the orchestrator's BASIC_AUTH credential. Was silently 401'ing every
audit-trail write (req.on('error') swallowed it), so site 1's first
full pipeline pass landed 0 rows in actions_log. Smoke-tested by
re-running stage 0: actions_log went 0 → 1 with the expected row.
---
sites/wholivedthere.com/app/lib/gtag.js | 13 +++++++++++++
stages/runners.js | 27 ++++++++++++++++++++++++---
2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/sites/wholivedthere.com/app/lib/gtag.js b/sites/wholivedthere.com/app/lib/gtag.js
new file mode 100644
index 0000000..9b8f9ae
--- /dev/null
+++ b/sites/wholivedthere.com/app/lib/gtag.js
@@ -0,0 +1,13 @@
+export const GA_TRACKING_ID = 'G-VV80JM88WB';
+
+export const pageview = (url) => {
+ window.gtag('config', GA_TRACKING_ID, { page_path: url });
+};
+
+export const event = ({ action, category, label, value }) => {
+ window.gtag('event', action, {
+ event_category: category,
+ event_label: label,
+ value,
+ });
+};
diff --git a/stages/runners.js b/stages/runners.js
index ead57e9..c440b8c 100644
--- a/stages/runners.js
+++ b/stages/runners.js
@@ -30,15 +30,36 @@ function brandFromDomain(domain) {
.replace(/\b\w/g, c => c.toUpperCase());
}
+// Audit-trail POSTs to /actions and /findings on the orchestrator. The
+// orchestrator's BASIC_AUTH middleware 401s any unauthenticated request,
+// and the previous version swallowed that 401 silently — actions_log
+// stayed empty for every pipeline run. Now we forward the same cred the
+// orchestrator was started with (BASIC_AUTH env, set in ecosystem.config.js).
+// Fixed 2026-05-19 after wholivedthere.com's first full pipeline pass
+// completed with 0 rows written to actions_log.
+const AUTH_HEADER = process.env.BASIC_AUTH
+ ? 'Basic ' + Buffer.from(process.env.BASIC_AUTH).toString('base64')
+ : null;
function postJSON(path, body) {
return new Promise((resolve) => {
const data = JSON.stringify(body);
const u = new URL(ORCH + path);
+ const headers = {
+ 'Content-Type': 'application/json',
+ 'Content-Length': Buffer.byteLength(data),
+ };
+ if (AUTH_HEADER) headers.Authorization = AUTH_HEADER;
const req = http.request({
hostname: u.hostname, port: u.port, path: u.pathname, method: 'POST',
- headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) },
- }, res => { res.on('data', () => {}); res.on('end', resolve); });
- req.on('error', () => resolve());
+ headers,
+ }, res => {
+ // Surface 4xx/5xx to the orchestrator log so silent-401 doesn't recur.
+ if (res.statusCode >= 400) {
+ console.error(`[runner] POST ${path} → ${res.statusCode}`);
+ }
+ res.on('data', () => {}); res.on('end', resolve);
+ });
+ req.on('error', (e) => { console.error(`[runner] POST ${path} error: ${e.message}`); resolve(); });
req.write(data); req.end();
});
}
← e27fd4f sf-cncp-panel: launchd → pm2 cron_restart (gui/$UID domain u
·
back to Site Factory
·
bubbesblock + claimmyaddress: ship live GA4 (backfill from s 417327d →