@maravilla-labs/functions 0.8.0 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/events/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM,CA8F5E"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/events/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAyG5E"}
@@ -69,12 +69,16 @@ async function handleEvent(id, event) {
69
69
  // POST <anything>
70
70
  // body: { "id": "<handler>", "event": { ... } }
71
71
  async function handleRequest(request) {
72
+ // Defined outside the try so the catch block can include the handler id
73
+ // in the diagnostic log line even when the throw happens before we've
74
+ // finished parsing the request body (rare, but cheap to handle).
75
+ let id = '<unknown>';
72
76
  try {
73
77
  const bodyText = await request.text();
74
78
  const parsed = bodyText ? JSON.parse(bodyText) : {};
75
- const id = parsed.id;
79
+ id = parsed.id || '<missing>';
76
80
  const event = parsed.event;
77
- if (!id) {
81
+ if (!parsed.id) {
78
82
  return new Response(
79
83
  JSON.stringify({ error: 'missing handler id' }),
80
84
  { status: 400, headers: { 'content-type': 'application/json' } },
@@ -86,9 +90,16 @@ async function handleRequest(request) {
86
90
  { status: 200, headers: { 'content-type': 'application/json' } },
87
91
  );
88
92
  } catch (err) {
89
- console.error('[events] handler invocation failed:', err && err.message || err);
93
+ // Surface the handler id + full stack so the journal pinpoints the
94
+ // throw site immediately. Prior to this change the log line was
95
+ // bare "[events] handler invocation failed: MESSAGE" with no
96
+ // handler attribution, which forced cross-referencing with Caddy
97
+ // access logs to guess which handler threw. See cloud-ops repo,
98
+ // DELIVERY_OUTAGE_2026-05-28.md.
99
+ const msg = (err && (err.stack || err.message)) || String(err);
100
+ console.error('[events] handler invocation failed: id=' + id + ' - ' + msg);
90
101
  return new Response(
91
- JSON.stringify({ ok: false, error: String(err && err.message || err) }),
102
+ JSON.stringify({ ok: false, handler: id, error: String(err && err.message || err) }),
92
103
  { status: 500, headers: { 'content-type': 'application/json' } },
93
104
  );
94
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/events/generator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IAClE,MAAM,OAAO,GAAG,OAAO;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;SAC5E,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/D,OAAO;EACP,OAAO;;mBAEU,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmF3B,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/events/generator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IAClE,MAAM,OAAO,GAAG,OAAO;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;SAC5E,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/D,OAAO;EACP,OAAO;;mBAEU,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8F3B,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maravilla-labs/functions",
3
- "version": "0.8.0",
3
+ "version": "0.8.3",
4
4
  "description": "Maravilla Edge Functions bundler and development tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",