@omen.foundation/node-microservice-runtime 0.1.98 → 0.1.100

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omen.foundation/node-microservice-runtime",
3
- "version": "0.1.98",
3
+ "version": "0.1.100",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -303,12 +303,12 @@ async function prepareUploadLocation(baseUrl, headers) {
303
303
  'Content-Length': '0',
304
304
  };
305
305
 
306
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
307
- console.error(`[beamo-node] [SUBSTEP: Prepare Upload Location]`);
308
- console.error(`[beamo-node] URL: ${url}`);
309
- console.error(`[beamo-node] Method: POST`);
310
- console.error(`[beamo-node] Headers:`, JSON.stringify(requestHeaders, null, 2));
311
- }
306
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
307
+ // console.error(`[beamo-node] [SUBSTEP: Prepare Upload Location]`);
308
+ // console.error(`[beamo-node] URL: ${url}`);
309
+ // console.error(`[beamo-node] Method: POST`);
310
+ // console.error(`[beamo-node] Headers:`, JSON.stringify(requestHeaders, null, 2));
311
+ // }
312
312
 
313
313
  let response;
314
314
  try {
@@ -326,48 +326,48 @@ async function prepareUploadLocation(baseUrl, headers) {
326
326
  ...(error instanceof Error && error.stack ? { stack: error.stack } : {}),
327
327
  ...(error instanceof Error && error.cause ? { cause: error.cause } : {}),
328
328
  };
329
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
330
- console.error('[beamo-node] Network error:', errorDetails);
331
- }
329
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
330
+ // console.error('[beamo-node] Network error:', errorDetails);
331
+ // }
332
332
  throw new Error(`Network error preparing upload location: ${errorMsg}. URL: ${url.toString()}`);
333
333
  }
334
334
 
335
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
336
- console.error(`[beamo-node] Response Status: ${response.status}`);
337
- console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
338
- }
335
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
336
+ // console.error(`[beamo-node] Response Status: ${response.status}`);
337
+ // console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
338
+ // }
339
339
 
340
340
  if (!response.ok) {
341
341
  const text = await response.text();
342
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
343
- console.error('[beamo-node] Upload location failed', {
344
- status: response.status,
345
- statusText: response.statusText,
346
- headers: Object.fromEntries(response.headers.entries()),
347
- body: text.substring(0, 500),
348
- });
349
- }
342
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
343
+ // console.error('[beamo-node] Upload location failed', {
344
+ // status: response.status,
345
+ // statusText: response.statusText,
346
+ // headers: Object.fromEntries(response.headers.entries()),
347
+ // body: text.substring(0, 500),
348
+ // });
349
+ // }
350
350
  throw new Error(`Failed to prepare upload location: ${response.status} ${text}`);
351
351
  }
352
352
  const location = response.headers.get('location');
353
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
354
- console.error(`[beamo-node] Upload Location: ${location}`);
355
- }
353
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
354
+ // console.error(`[beamo-node] Upload Location: ${location}`);
355
+ // }
356
356
  return location;
357
357
  }
358
358
 
359
359
  async function uploadBlob(baseUrl, digest, buffer, headers) {
360
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
361
- console.error(`[beamo-node] [SUBSTEP: Upload Blob]`);
362
- console.error(`[beamo-node] Digest: ${digest}`);
363
- console.error(`[beamo-node] Size: ${buffer.length} bytes`);
364
- }
360
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
361
+ // console.error(`[beamo-node] [SUBSTEP: Upload Blob]`);
362
+ // console.error(`[beamo-node] Digest: ${digest}`);
363
+ // console.error(`[beamo-node] Size: ${buffer.length} bytes`);
364
+ // }
365
365
 
366
366
  const exists = await checkBlobExists(baseUrl, digest, headers);
367
367
  if (exists) {
368
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
369
- console.error(`[beamo-node] Blob already exists, skipping upload`);
370
- }
368
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
369
+ // console.error(`[beamo-node] Blob already exists, skipping upload`);
370
+ // }
371
371
  return { digest, size: buffer.length };
372
372
  }
373
373
 
@@ -384,12 +384,12 @@ async function uploadBlob(baseUrl, digest, buffer, headers) {
384
384
  locationUrl.searchParams.set('digest', digest);
385
385
  const uploadUrl = locationUrl;
386
386
 
387
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
388
- console.error(`[beamo-node] Upload URL: ${uploadUrl}`);
389
- console.error(`[beamo-node] Method: PUT`);
390
- const uploadHeaders = { ...headers, 'Content-Type': 'application/octet-stream' };
391
- console.error(`[beamo-node] Upload Headers:`, JSON.stringify(uploadHeaders, null, 2));
392
- }
387
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
388
+ // console.error(`[beamo-node] Upload URL: ${uploadUrl}`);
389
+ // console.error(`[beamo-node] Method: PUT`);
390
+ // const uploadHeaders = { ...headers, 'Content-Type': 'application/octet-stream' };
391
+ // console.error(`[beamo-node] Upload Headers:`, JSON.stringify(uploadHeaders, null, 2));
392
+ // }
393
393
 
394
394
  const response = await fetch(uploadUrl, {
395
395
  method: 'PUT',
@@ -397,22 +397,22 @@ async function uploadBlob(baseUrl, digest, buffer, headers) {
397
397
  body: buffer,
398
398
  });
399
399
 
400
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
401
- console.error(`[beamo-node] Response Status: ${response.status}`);
402
- console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
403
- }
404
-
400
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
401
+ // console.error(`[beamo-node] Response Status: ${response.status}`);
402
+ // console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
403
+ // }
404
+
405
405
  if (!response.ok) {
406
406
  const text = await response.text();
407
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
408
- console.error(`[beamo-node] Response Body: ${text.substring(0, 500)}`);
409
- }
407
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
408
+ // console.error(`[beamo-node] Response Body: ${text.substring(0, 500)}`);
409
+ // }
410
410
  throw new Error(`Failed to upload blob ${digest}: ${response.status} ${text}`);
411
411
  }
412
412
 
413
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
414
- console.error(`[beamo-node] Blob upload successful`);
415
- }
413
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
414
+ // console.error(`[beamo-node] Blob upload successful`);
415
+ // }
416
416
 
417
417
  return { digest, size: buffer.length };
418
418
  }
@@ -424,14 +424,14 @@ async function uploadManifest(baseUrl, manifestJson, shortImageId, headers) {
424
424
  const url = new URL(`manifests/${shortImageId}`, baseUrl);
425
425
  const requestHeaders = { ...headers, 'Content-Type': MANIFEST_MEDIA_TYPE };
426
426
 
427
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
428
- console.error(`[beamo-node] [SUBSTEP: Upload Manifest to Registry]`);
429
- console.error(`[beamo-node] URL: ${url}`);
430
- console.error(`[beamo-node] Method: PUT`);
431
- console.error(`[beamo-node] Tag: ${shortImageId}`);
432
- console.error(`[beamo-node] Headers:`, JSON.stringify(requestHeaders, null, 2));
433
- console.error(`[beamo-node] Manifest JSON:`, manifestJsonString);
434
- }
427
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
428
+ // console.error(`[beamo-node] [SUBSTEP: Upload Manifest to Registry]`);
429
+ // console.error(`[beamo-node] URL: ${url}`);
430
+ // console.error(`[beamo-node] Method: PUT`);
431
+ // console.error(`[beamo-node] Tag: ${shortImageId}`);
432
+ // console.error(`[beamo-node] Headers:`, JSON.stringify(requestHeaders, null, 2));
433
+ // console.error(`[beamo-node] Manifest JSON:`, manifestJsonString);
434
+ // }
435
435
 
436
436
  const response = await fetch(url, {
437
437
  method: 'PUT',
@@ -439,22 +439,22 @@ async function uploadManifest(baseUrl, manifestJson, shortImageId, headers) {
439
439
  body: manifestJsonString,
440
440
  });
441
441
 
442
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
443
- console.error(`[beamo-node] Response Status: ${response.status}`);
444
- console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
445
- }
442
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
443
+ // console.error(`[beamo-node] Response Status: ${response.status}`);
444
+ // console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
445
+ // }
446
446
 
447
447
  if (!response.ok) {
448
448
  const text = await response.text();
449
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
450
- console.error(`[beamo-node] Response Body: ${text.substring(0, 500)}`);
451
- }
449
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
450
+ // console.error(`[beamo-node] Response Body: ${text.substring(0, 500)}`);
451
+ // }
452
452
  throw new Error(`Failed to upload manifest: ${response.status} ${text}`);
453
453
  }
454
454
 
455
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
456
- console.error(`[beamo-node] Manifest upload successful`);
457
- }
455
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
456
+ // console.error(`[beamo-node] Manifest upload successful`);
457
+ // }
458
458
  }
459
459
 
460
460
  async function fetchJson(url, options = {}) {
@@ -469,19 +469,15 @@ async function fetchJson(url, options = {}) {
469
469
  }
470
470
 
471
471
  async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
472
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
473
- console.error(`[beamo-node] [STEP: Resolve Game PID]`);
474
- console.error(`[beamo-node] Explicit Game PID: ${explicitGamePid || '(none)'}`);
475
- console.error(`[beamo-node] Realm PID: ${pid}`);
476
- }
472
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
473
+ // console.error(`[beamo-node] [STEP: Resolve Game PID]`);
474
+ // console.error(`[beamo-node] Explicit Game PID: ${explicitGamePid || '(none)'}`);
475
+ // console.error(`[beamo-node] Realm PID: ${pid}`);
476
+ // console.error(`[beamo-node] NOTE: Always resolving root project (Game ID) from API, ignoring explicit value`);
477
+ // }
477
478
 
478
- if (explicitGamePid) {
479
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
480
- console.error(`[beamo-node] Using explicit game PID: ${explicitGamePid}`);
481
- }
482
- return explicitGamePid;
483
- }
484
-
479
+ // Always resolve the root project from the API (matching C# CLI's FindRoot().Pid)
480
+ // The explicit game PID might be incorrect (could be realm PID instead of root)
485
481
  const scope = pid ? `${cid}.${pid}` : cid;
486
482
  try {
487
483
  const url = new URL(`/basic/realms/game`, apiHost);
@@ -492,22 +488,22 @@ async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
492
488
  ...(scope ? { 'X-BEAM-SCOPE': scope } : {}),
493
489
  };
494
490
 
495
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
496
- console.error(`[beamo-node] Fetching game PID from: ${url}`);
497
- console.error(`[beamo-node] Headers:`, JSON.stringify(requestHeaders, null, 2));
498
- }
491
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
492
+ // console.error(`[beamo-node] Fetching game PID from: ${url}`);
493
+ // console.error(`[beamo-node] Headers:`, JSON.stringify(requestHeaders, null, 2));
494
+ // }
499
495
 
500
496
  const body = await fetchJson(url, { headers: requestHeaders });
501
497
 
502
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
503
- console.error(`[beamo-node] Response:`, JSON.stringify(body, null, 2));
504
- }
498
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
499
+ // console.error(`[beamo-node] Response:`, JSON.stringify(body, null, 2));
500
+ // }
505
501
 
506
502
  const projects = Array.isArray(body?.projects) ? body.projects : [];
507
503
  if (projects.length === 0) {
508
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
509
- console.error(`[beamo-node] No projects found, using realm PID: ${pid}`);
510
- }
504
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
505
+ // console.error(`[beamo-node] No projects found, using realm PID: ${pid}`);
506
+ // }
511
507
  return pid;
512
508
  }
513
509
 
@@ -515,9 +511,9 @@ async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
515
511
  const byPid = new Map(projects.map((project) => [project.pid, project]));
516
512
  let current = byPid.get(pid);
517
513
  if (!current) {
518
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
519
- console.error(`[beamo-node] Realm PID not found in projects, using realm PID: ${pid}`);
520
- }
514
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
515
+ // console.error(`[beamo-node] Realm PID not found in projects, using realm PID: ${pid}`);
516
+ // }
521
517
  return pid;
522
518
  }
523
519
 
@@ -534,9 +530,13 @@ async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
534
530
  // current is now the root (or the original if no parent chain)
535
531
  const resolved = current?.pid ?? pid;
536
532
 
537
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
538
- console.error(`[beamo-node] Resolved Game PID: ${resolved}`);
539
- }
533
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
534
+ // console.error(`[beamo-node] Resolved Game PID (root): ${resolved}`);
535
+ // if (explicitGamePid && explicitGamePid !== resolved) {
536
+ // console.error(`[beamo-node] ⚠️ WARNING: Explicit Game PID (${explicitGamePid}) does not match resolved root (${resolved})`);
537
+ // console.error(`[beamo-node] Using resolved root (${resolved}) for imageNameMD5 calculation`);
538
+ // }
539
+ // }
540
540
  return resolved;
541
541
  } catch (error) {
542
542
  // Debug logging only
@@ -588,18 +588,18 @@ async function getRegistryUrl(apiHost, token, cid, pid) {
588
588
  ...(scope ? { 'X-BEAM-SCOPE': scope } : {}),
589
589
  };
590
590
 
591
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
592
- console.error(`[beamo-node] [STEP: Get Registry URL]`);
593
- console.error(`[beamo-node] URL: ${url}`);
594
- console.error(`[beamo-node] Headers:`, JSON.stringify(headers, null, 2));
595
- console.error(`[beamo-node] Scope: ${scope}`);
596
- }
591
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
592
+ // console.error(`[beamo-node] [STEP: Get Registry URL]`);
593
+ // console.error(`[beamo-node] URL: ${url}`);
594
+ // console.error(`[beamo-node] Headers:`, JSON.stringify(headers, null, 2));
595
+ // console.error(`[beamo-node] Scope: ${scope}`);
596
+ // }
597
597
 
598
598
  const body = await fetchJson(url, { headers });
599
599
 
600
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
601
- console.error(`[beamo-node] Response:`, JSON.stringify(body, null, 2));
602
- }
600
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
601
+ // console.error(`[beamo-node] Response:`, JSON.stringify(body, null, 2));
602
+ // }
603
603
 
604
604
  const uri = body.uri || body.registry || body.url;
605
605
  if (!uri) {
@@ -611,9 +611,9 @@ async function getRegistryUrl(apiHost, token, cid, pid) {
611
611
  // parsedUri.Host in C# is just the hostname (no port), so we use hostname here
612
612
  const registryUrl = `${parsed.protocol}//${parsed.hostname}/v2/`;
613
613
 
614
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
615
- console.error(`[beamo-node] Normalized Registry URL: ${registryUrl}`);
616
- }
614
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
615
+ // console.error(`[beamo-node] Normalized Registry URL: ${registryUrl}`);
616
+ // }
617
617
 
618
618
  return registryUrl;
619
619
  }
@@ -640,18 +640,18 @@ async function uploadDockerImage({
640
640
  'x-ks-token': token, // Access token from login
641
641
  };
642
642
 
643
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
644
- console.error(`[beamo-node] [STEP: Upload Docker Image]`);
645
- console.error(`[beamo-node] Base URL: ${baseUrl}`);
646
- console.error(`[beamo-node] Registry URL: ${registryUrl}`);
647
- console.error(`[beamo-node] Unique Name: ${uniqueName}`);
648
- console.error(`[beamo-node] Service ID: ${serviceId}`);
649
- console.error(`[beamo-node] CID: ${cid}`);
650
- console.error(`[beamo-node] Realm PID: ${pid}`);
651
- console.error(`[beamo-node] Game PID: ${gamePid}`);
652
- console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
653
- console.error(`[beamo-node] Upload Headers:`, JSON.stringify(headers, null, 2));
654
- }
643
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
644
+ // console.error(`[beamo-node] [STEP: Upload Docker Image]`);
645
+ // console.error(`[beamo-node] Base URL: ${baseUrl}`);
646
+ // console.error(`[beamo-node] Registry URL: ${registryUrl}`);
647
+ // console.error(`[beamo-node] Unique Name: ${uniqueName}`);
648
+ // console.error(`[beamo-node] Service ID: ${serviceId}`);
649
+ // console.error(`[beamo-node] CID: ${cid}`);
650
+ // console.error(`[beamo-node] Realm PID: ${pid}`);
651
+ // console.error(`[beamo-node] Game PID: ${gamePid}`);
652
+ // console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
653
+ // console.error(`[beamo-node] Upload Headers:`, JSON.stringify(headers, null, 2));
654
+ // }
655
655
 
656
656
  const { manifestEntry, configBuffer, layers } = await readDockerImageTar(imageTarPath);
657
657
 
@@ -660,37 +660,37 @@ async function uploadDockerImage({
660
660
  process.stdout.write(`\r${colors.blue}↑${colors.reset} Uploading config...`);
661
661
  }
662
662
  const configDigestValue = sha256Digest(configBuffer);
663
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
664
- console.error(`[beamo-node] [SUBSTEP: Upload Config]`);
665
- console.error(`[beamo-node] Config Digest: ${configDigestValue}`);
666
- console.error(`[beamo-node] Config Size: ${configBuffer.length} bytes`);
667
- }
663
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
664
+ // console.error(`[beamo-node] [SUBSTEP: Upload Config]`);
665
+ // console.error(`[beamo-node] Config Digest: ${configDigestValue}`);
666
+ // console.error(`[beamo-node] Config Size: ${configBuffer.length} bytes`);
667
+ // }
668
668
  const configDigest = await uploadBlob(baseUrl, configDigestValue, configBuffer, headers);
669
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
670
- console.error(`[beamo-node] Config Upload Result:`, JSON.stringify(configDigest, null, 2));
671
- }
669
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
670
+ // console.error(`[beamo-node] Config Upload Result:`, JSON.stringify(configDigest, null, 2));
671
+ // }
672
672
 
673
673
  // Upload layers with progress
674
674
  const layerDescriptors = [];
675
675
  const totalLayers = layers.length;
676
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
677
- console.error(`[beamo-node] [SUBSTEP: Upload Layers]`);
678
- console.error(`[beamo-node] Total Layers: ${totalLayers}`);
679
- }
676
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
677
+ // console.error(`[beamo-node] [SUBSTEP: Upload Layers]`);
678
+ // console.error(`[beamo-node] Total Layers: ${totalLayers}`);
679
+ // }
680
680
  for (let i = 0; i < layers.length; i++) {
681
681
  if (progress) {
682
682
  process.stdout.write(`\r${colors.blue}↑${colors.reset} Uploading layers (${i + 1}/${totalLayers})...`);
683
683
  }
684
684
  const layerDigestValue = sha256Digest(layers[i].buffer);
685
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
686
- console.error(`[beamo-node] Layer ${i + 1}/${totalLayers}:`);
687
- console.error(`[beamo-node] Digest: ${layerDigestValue}`);
688
- console.error(`[beamo-node] Size: ${layers[i].buffer.length} bytes`);
689
- }
685
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
686
+ // console.error(`[beamo-node] Layer ${i + 1}/${totalLayers}:`);
687
+ // console.error(`[beamo-node] Digest: ${layerDigestValue}`);
688
+ // console.error(`[beamo-node] Size: ${layers[i].buffer.length} bytes`);
689
+ // }
690
690
  const descriptor = await uploadBlob(baseUrl, layerDigestValue, layers[i].buffer, headers);
691
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
692
- console.error(`[beamo-node] Upload Result:`, JSON.stringify(descriptor, null, 2));
693
- }
691
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
692
+ // console.error(`[beamo-node] Upload Result:`, JSON.stringify(descriptor, null, 2));
693
+ // }
694
694
  layerDescriptors.push({
695
695
  digest: descriptor.digest,
696
696
  size: descriptor.size,
@@ -714,15 +714,15 @@ async function uploadDockerImage({
714
714
  process.stdout.write(`\r${colors.blue}↑${colors.reset} Uploading manifest...`);
715
715
  }
716
716
  const shortImageId = shortDigest(fullImageId);
717
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
718
- console.error(`[beamo-node] [SUBSTEP: Upload Manifest]`);
719
- console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
720
- console.error(`[beamo-node] Manifest JSON:`, JSON.stringify(uploadManifestJson, null, 2));
721
- }
717
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
718
+ // console.error(`[beamo-node] [SUBSTEP: Upload Manifest]`);
719
+ // console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
720
+ // console.error(`[beamo-node] Manifest JSON:`, JSON.stringify(uploadManifestJson, null, 2));
721
+ // }
722
722
  await uploadManifest(baseUrl, uploadManifestJson, shortImageId, headers);
723
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
724
- console.error(`[beamo-node] Manifest Upload Complete`);
725
- }
723
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
724
+ // console.error(`[beamo-node] Manifest Upload Complete`);
725
+ // }
726
726
  if (progress) {
727
727
  process.stdout.write('\r');
728
728
  }
@@ -1022,23 +1022,23 @@ async function updateManifest({
1022
1022
  'X-BEAM-SCOPE': `${cid}.${pid}`,
1023
1023
  };
1024
1024
 
1025
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1026
- console.error(`[beamo-node] [STEP: Publish Manifest to Backend]`);
1027
- console.error(`[beamo-node] URL: ${publishUrl}`);
1028
- console.error(`[beamo-node] Method: POST`);
1029
- console.error(`[beamo-node] Headers:`, JSON.stringify(publishHeaders, null, 2));
1030
- console.error(`[beamo-node] Service: ${serviceId}`);
1031
- console.error(`[beamo-node] CID: ${cid}`);
1032
- console.error(`[beamo-node] Realm PID (from X-BEAM-SCOPE): ${pid}`);
1033
- console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
1034
- console.error(`[beamo-node] Expected Backend Check:`);
1035
- console.error(`[beamo-node] - Backend will calculate imageNameMD5 using: rc.cid, rc.gameId, serviceName`);
1036
- console.error(`[beamo-node] - Backend will check: {registryURI}/{imageNameMD5}/manifests/{imageId}`);
1037
- console.error(`[beamo-node] - Backend will use headers: X-KS-PROJECTID: rc.projectId (from X-BEAM-SCOPE)`);
1038
- console.error(`[beamo-node] - NOTE: rc.gameId might differ from realm PID if backend resolves it differently`);
1039
- console.error(`[beamo-node] Request Body:`, JSON.stringify(requestBody, null, 2));
1040
- console.error(`[beamo-node] Service Entry in Manifest:`, JSON.stringify(mappedServices.find(s => s.serviceName === serviceId), null, 2));
1041
- }
1025
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1026
+ // console.error(`[beamo-node] [STEP: Publish Manifest to Backend]`);
1027
+ // console.error(`[beamo-node] URL: ${publishUrl}`);
1028
+ // console.error(`[beamo-node] Method: POST`);
1029
+ // console.error(`[beamo-node] Headers:`, JSON.stringify(publishHeaders, null, 2));
1030
+ // console.error(`[beamo-node] Service: ${serviceId}`);
1031
+ // console.error(`[beamo-node] CID: ${cid}`);
1032
+ // console.error(`[beamo-node] Realm PID (from X-BEAM-SCOPE): ${pid}`);
1033
+ // console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
1034
+ // console.error(`[beamo-node] Expected Backend Check:`);
1035
+ // console.error(`[beamo-node] - Backend will calculate imageNameMD5 using: rc.cid, rc.gameId, serviceName`);
1036
+ // console.error(`[beamo-node] - Backend will check: {registryURI}/{imageNameMD5}/manifests/{imageId}`);
1037
+ // console.error(`[beamo-node] - Backend will use headers: X-KS-PROJECTID: rc.projectId (from X-BEAM-SCOPE)`);
1038
+ // console.error(`[beamo-node] - NOTE: rc.gameId might differ from realm PID if backend resolves it differently`);
1039
+ // console.error(`[beamo-node] Request Body:`, JSON.stringify(requestBody, null, 2));
1040
+ // console.error(`[beamo-node] Service Entry in Manifest:`, JSON.stringify(mappedServices.find(s => s.serviceName === serviceId), null, 2));
1041
+ // }
1042
1042
 
1043
1043
  const response = await fetch(publishUrl, {
1044
1044
  method: 'POST',
@@ -1046,25 +1046,25 @@ async function updateManifest({
1046
1046
  body: JSON.stringify(requestBody),
1047
1047
  });
1048
1048
 
1049
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1050
- console.error(`[beamo-node] Response Status: ${response.status}`);
1051
- console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
1052
- }
1053
-
1049
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1050
+ // console.error(`[beamo-node] Response Status: ${response.status}`);
1051
+ // console.error(`[beamo-node] Response Headers:`, JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2));
1052
+ // }
1053
+
1054
1054
  if (!response.ok) {
1055
1055
  const text = await response.text();
1056
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1057
- console.error(`[beamo-node] Response Body: ${text}`);
1058
- console.error(`[beamo-node] Full Request Body (for debugging):`, JSON.stringify(requestBody, null, 2));
1059
- }
1056
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1057
+ // console.error(`[beamo-node] Response Body: ${text}`);
1058
+ // console.error(`[beamo-node] Full Request Body (for debugging):`, JSON.stringify(requestBody, null, 2));
1059
+ // }
1060
1060
  throw new Error(`Failed to publish manifest: ${response.status} ${text}`);
1061
1061
  }
1062
1062
 
1063
1063
  const responseBody = await response.json();
1064
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1065
- console.error(`[beamo-node] Response Body:`, JSON.stringify(responseBody, null, 2));
1066
- console.error(`[beamo-node] ✓ Manifest published successfully`);
1067
- }
1064
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1065
+ // console.error(`[beamo-node] Response Body:`, JSON.stringify(responseBody, null, 2));
1066
+ // console.error(`[beamo-node] ✓ Manifest published successfully`);
1067
+ // }
1068
1068
  }
1069
1069
 
1070
1070
  async function prepareDockerContext({ entry, distDir, openapiPath, packageJson, packageLock, nodeVersion }) {
@@ -1267,16 +1267,16 @@ async function main() {
1267
1267
  const inspect = await runCommand('docker', ['image', 'inspect', '--format', '{{.Id}}', dockerTag], { capture: true });
1268
1268
  const fullImageId = inspect.stdout.trim();
1269
1269
  const imageTarPath = path.join(tempRoot, `${serviceId.replace(/[^a-z0-9-_]/gi, '_')}.tar`);
1270
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1271
- // Calculate short digest manually (shortDigest function defined later)
1272
- const longImageId = fullImageId.includes(':') ? fullImageId.split(':')[1] : fullImageId;
1273
- const shortImageIdPreview = longImageId.substring(0, 12);
1274
- console.error(`[beamo-node] [STEP: Extract Image ID]`);
1275
- console.error(`[beamo-node] Docker Tag: ${dockerTag}`);
1276
- console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
1277
- console.error(`[beamo-node] Short Image ID (preview): ${shortImageIdPreview}`);
1278
- console.error(`[beamo-node] Image Tar Path: ${imageTarPath}`);
1279
- }
1270
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1271
+ // // Calculate short digest manually (shortDigest function defined later)
1272
+ // const longImageId = fullImageId.includes(':') ? fullImageId.split(':')[1] : fullImageId;
1273
+ // const shortImageIdPreview = longImageId.substring(0, 12);
1274
+ // console.error(`[beamo-node] [STEP: Extract Image ID]`);
1275
+ // console.error(`[beamo-node] Docker Tag: ${dockerTag}`);
1276
+ // console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
1277
+ // console.error(`[beamo-node] Short Image ID (preview): ${shortImageIdPreview}`);
1278
+ // console.error(`[beamo-node] Image Tar Path: ${imageTarPath}`);
1279
+ // }
1280
1280
  await runCommand('docker', ['image', 'save', dockerTag, '-o', imageTarPath], { silent: true });
1281
1281
  progress.complete('Image prepared');
1282
1282
 
@@ -1305,21 +1305,21 @@ async function main() {
1305
1305
 
1306
1306
  // Match C# CLI: GetDockerImageRegistryUri() uses realm PID from context (X-BEAM-SCOPE)
1307
1307
  // uniqueName uses gamePid (matches backend's rc.gameId), but registry URL uses realm PID
1308
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1309
- console.error(`[beamo-node] [STEP: Calculate Registry Path]`);
1310
- console.error(`[beamo-node] CID: ${cid}`);
1311
- console.error(`[beamo-node] Realm PID: ${pid}`);
1312
- console.error(`[beamo-node] Resolved Game PID: ${resolvedGamePid}`);
1313
- console.error(`[beamo-node] Service ID: ${serviceId}`);
1314
- }
1308
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1309
+ // console.error(`[beamo-node] [STEP: Calculate Registry Path]`);
1310
+ // console.error(`[beamo-node] CID: ${cid}`);
1311
+ // console.error(`[beamo-node] Realm PID: ${pid}`);
1312
+ // console.error(`[beamo-node] Resolved Game PID: ${resolvedGamePid}`);
1313
+ // console.error(`[beamo-node] Service ID: ${serviceId}`);
1314
+ // }
1315
1315
  const registryUrl = await getRegistryUrl(apiHost, token, cid, pid);
1316
1316
  const uniqueNameInput = `${cid}_${resolvedGamePid}_${serviceId}`;
1317
1317
  const uniqueName = md5Hex(uniqueNameInput).substring(0, 30);
1318
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1319
- console.error(`[beamo-node] Unique Name Input: ${uniqueNameInput}`);
1320
- console.error(`[beamo-node] Unique Name (MD5 first 30 chars): ${uniqueName}`);
1321
- console.error(`[beamo-node] Registry URL: ${registryUrl}`);
1322
- }
1318
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1319
+ // console.error(`[beamo-node] Unique Name Input: ${uniqueNameInput}`);
1320
+ // console.error(`[beamo-node] Unique Name (MD5 first 30 chars): ${uniqueName}`);
1321
+ // console.error(`[beamo-node] Registry URL: ${registryUrl}`);
1322
+ // }
1323
1323
  progress.complete('Authenticated');
1324
1324
 
1325
1325
  // Step 6: Upload Docker image
@@ -1348,19 +1348,19 @@ async function main() {
1348
1348
  'x-ks-token': token,
1349
1349
  };
1350
1350
 
1351
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1352
- console.error(`[beamo-node] [STEP: Post-Upload Verification]`);
1353
- console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
1354
- console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
1355
- console.error(`[beamo-node] Base URL: ${baseUrl}`);
1356
- console.error(`[beamo-node] Verification URL: ${baseUrl}manifests/${shortImageId}`);
1357
- console.error(`[beamo-node] Verify Headers:`, JSON.stringify(verifyHeaders, null, 2));
1358
- }
1351
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1352
+ // console.error(`[beamo-node] [STEP: Post-Upload Verification]`);
1353
+ // console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
1354
+ // console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
1355
+ // console.error(`[beamo-node] Base URL: ${baseUrl}`);
1356
+ // console.error(`[beamo-node] Verification URL: ${baseUrl}manifests/${shortImageId}`);
1357
+ // console.error(`[beamo-node] Verify Headers:`, JSON.stringify(verifyHeaders, null, 2));
1358
+ // }
1359
1359
 
1360
1360
  // Wait a moment for registry to propagate
1361
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1362
- console.error(`[beamo-node] Waiting 3 seconds for registry propagation...`);
1363
- }
1361
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1362
+ // console.error(`[beamo-node] Waiting 3 seconds for registry propagation...`);
1363
+ // }
1364
1364
  await new Promise(resolve => setTimeout(resolve, 3000));
1365
1365
 
1366
1366
  const imageExists = await verifyManifestExists(baseUrl, shortImageId, verifyHeaders);
@@ -1368,72 +1368,72 @@ async function main() {
1368
1368
  throw new Error(`Image verification failed: manifest with tag ${shortImageId} not found in registry at ${baseUrl}manifests/${shortImageId}. The image may not have uploaded successfully.`);
1369
1369
  }
1370
1370
 
1371
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1372
- console.error(`[beamo-node] ✓ Image verification passed`);
1373
- }
1371
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1372
+ // console.error(`[beamo-node] ✓ Image verification passed`);
1373
+ // }
1374
1374
 
1375
1375
  // CRITICAL: Perform exact backend check simulation
1376
1376
  // The backend uses HEAD request with specific headers - let's verify it works
1377
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1378
- console.error(`[beamo-node] [STEP: Backend Check Simulation]`);
1379
- console.error(`[beamo-node] Simulating exact backend check...`);
1380
- const backendCheckUrl = `${registryUrl}${uniqueName}/manifests/${shortImageId}`;
1381
- console.error(`[beamo-node] Backend will check: ${backendCheckUrl}`);
1382
- console.error(`[beamo-node] Backend will use headers:`, JSON.stringify(verifyHeaders, null, 2));
1383
- try {
1384
- const backendCheckResponse = await fetch(backendCheckUrl, {
1385
- method: 'HEAD',
1386
- headers: verifyHeaders,
1387
- });
1388
- console.error(`[beamo-node] Backend simulation response status: ${backendCheckResponse.status}`);
1389
- if (backendCheckResponse.status !== 200) {
1390
- console.error(`[beamo-node] ⚠️ Backend simulation FAILED - status ${backendCheckResponse.status}`);
1391
- const responseText = await backendCheckResponse.text().catch(() => '');
1392
- console.error(`[beamo-node] Response: ${responseText}`);
1393
- } else {
1394
- console.error(`[beamo-node] ✓ Backend simulation passed`);
1395
- }
1396
- } catch (error) {
1397
- console.error(`[beamo-node] ⚠️ Backend simulation error: ${error.message}`);
1398
- }
1399
- }
1377
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1378
+ // console.error(`[beamo-node] [STEP: Backend Check Simulation]`);
1379
+ // console.error(`[beamo-node] Simulating exact backend check...`);
1380
+ // const backendCheckUrl = `${registryUrl}${uniqueName}/manifests/${shortImageId}`;
1381
+ // console.error(`[beamo-node] Backend will check: ${backendCheckUrl}`);
1382
+ // console.error(`[beamo-node] Backend will use headers:`, JSON.stringify(verifyHeaders, null, 2));
1383
+ // try {
1384
+ // const backendCheckResponse = await fetch(backendCheckUrl, {
1385
+ // method: 'HEAD',
1386
+ // headers: verifyHeaders,
1387
+ // });
1388
+ // console.error(`[beamo-node] Backend simulation response status: ${backendCheckResponse.status}`);
1389
+ // if (backendCheckResponse.status !== 200) {
1390
+ // console.error(`[beamo-node] ⚠️ Backend simulation FAILED - status ${backendCheckResponse.status}`);
1391
+ // const responseText = await backendCheckResponse.text().catch(() => '');
1392
+ // console.error(`[beamo-node] Response: ${responseText}`);
1393
+ // } else {
1394
+ // console.error(`[beamo-node] ✓ Backend simulation passed`);
1395
+ // }
1396
+ // } catch (error) {
1397
+ // console.error(`[beamo-node] ⚠️ Backend simulation error: ${error.message}`);
1398
+ // }
1399
+ // }
1400
1400
 
1401
1401
  // CRITICAL: Before publishing, verify using the backend's expected gameId
1402
1402
  // The backend resolves rc.gameId from the realm hierarchy, which might differ from our resolvedGamePid
1403
1403
  // We need to check what the backend will actually use
1404
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1405
- console.error(`[beamo-node] [STEP: Pre-Publish Backend Simulation]`);
1406
- console.error(`[beamo-node] Simulating backend's imageNameMD5 calculation...`);
1407
- console.error(`[beamo-node] Backend will use: rc.cid, rc.gameId (resolved from realm hierarchy), serviceName`);
1408
- console.error(`[beamo-node] Our calculation used: cid=${cid}, gamePid=${resolvedGamePid}, serviceName=${serviceId}`);
1409
- console.error(`[beamo-node] Our uniqueName: ${uniqueName}`);
1410
- console.error(`[beamo-node] WARNING: If backend's rc.gameId differs from our resolvedGamePid, the check will fail!`);
1411
- }
1404
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1405
+ // console.error(`[beamo-node] [STEP: Pre-Publish Backend Simulation]`);
1406
+ // console.error(`[beamo-node] Simulating backend's imageNameMD5 calculation...`);
1407
+ // console.error(`[beamo-node] Backend will use: rc.cid, rc.gameId (resolved from realm hierarchy), serviceName`);
1408
+ // console.error(`[beamo-node] Our calculation used: cid=${cid}, gamePid=${resolvedGamePid}, serviceName=${serviceId}`);
1409
+ // console.error(`[beamo-node] Our uniqueName: ${uniqueName}`);
1410
+ // console.error(`[beamo-node] WARNING: If backend's rc.gameId differs from our resolvedGamePid, the check will fail!`);
1411
+ // }
1412
1412
 
1413
1413
  // Try to resolve what the backend's rc.gameId will be by making the same API call the backend would make
1414
1414
  // The backend resolves gameId from the realm hierarchy when processing X-BEAM-SCOPE
1415
- try {
1416
- const backendGamePidCheck = await resolveGamePid(apiHost, token, cid, pid, null); // Force resolution
1417
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1418
- console.error(`[beamo-node] Backend's expected gameId (resolved from realm hierarchy): ${backendGamePidCheck}`);
1419
- if (backendGamePidCheck !== resolvedGamePid) {
1420
- console.error(`[beamo-node] ⚠️ MISMATCH DETECTED!`);
1421
- console.error(`[beamo-node] Our resolvedGamePid: ${resolvedGamePid}`);
1422
- console.error(`[beamo-node] Backend's expected gameId: ${backendGamePidCheck}`);
1423
- console.error(`[beamo-node] This will cause imageNameMD5 mismatch!`);
1424
- const backendUniqueNameInput = `${cid}_${backendGamePidCheck}_${serviceId}`;
1425
- const backendUniqueName = md5Hex(backendUniqueNameInput).substring(0, 30);
1426
- console.error(`[beamo-node] Backend will check: ${registryUrl}${backendUniqueName}/manifests/${shortImageId}`);
1427
- console.error(`[beamo-node] But we uploaded to: ${registryUrl}${uniqueName}/manifests/${shortImageId}`);
1428
- } else {
1429
- console.error(`[beamo-node] ✓ Game PID matches - backend should find the image`);
1430
- }
1431
- }
1432
- } catch (error) {
1433
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1434
- console.error(`[beamo-node] Could not verify backend gameId resolution: ${error.message}`);
1435
- }
1436
- }
1415
+ // try {
1416
+ // const backendGamePidCheck = await resolveGamePid(apiHost, token, cid, pid, null); // Force resolution
1417
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1418
+ // console.error(`[beamo-node] Backend's expected gameId (resolved from realm hierarchy): ${backendGamePidCheck}`);
1419
+ // if (backendGamePidCheck !== resolvedGamePid) {
1420
+ // console.error(`[beamo-node] ⚠️ MISMATCH DETECTED!`);
1421
+ // console.error(`[beamo-node] Our resolvedGamePid: ${resolvedGamePid}`);
1422
+ // console.error(`[beamo-node] Backend's expected gameId: ${backendGamePidCheck}`);
1423
+ // console.error(`[beamo-node] This will cause imageNameMD5 mismatch!`);
1424
+ // const backendUniqueNameInput = `${cid}_${backendGamePidCheck}_${serviceId}`;
1425
+ // const backendUniqueName = md5Hex(backendUniqueNameInput).substring(0, 30);
1426
+ // console.error(`[beamo-node] Backend will check: ${registryUrl}${backendUniqueName}/manifests/${shortImageId}`);
1427
+ // console.error(`[beamo-node] But we uploaded to: ${registryUrl}${uniqueName}/manifests/${shortImageId}`);
1428
+ // } else {
1429
+ // console.error(`[beamo-node] ✓ Game PID matches - backend should find the image`);
1430
+ // }
1431
+ // }
1432
+ // } catch (error) {
1433
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1434
+ // console.error(`[beamo-node] Could not verify backend gameId resolution: ${error.message}`);
1435
+ // }
1436
+ // }
1437
1437
 
1438
1438
  // Step 7: Discover storage, components, and dependencies
1439
1439
  progress.start('Discovering storage objects and components');
@@ -1483,19 +1483,19 @@ main().catch(async (error) => {
1483
1483
  console.error(`\n${colors.red}${colors.bright}✗ Publish failed${colors.reset}`);
1484
1484
  if (error instanceof Error) {
1485
1485
  console.error(`${colors.red}${error.message}${colors.reset}`);
1486
- if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1487
- console.error(`\n${colors.dim}Stack:${colors.reset} ${error.stack}`);
1488
- if (error.cause) {
1489
- console.error(`${colors.dim}Cause:${colors.reset} ${error.cause}`);
1490
- }
1491
- if (error.stdout) {
1492
- console.error(`${colors.dim}stdout:${colors.reset} ${error.stdout}`);
1493
- }
1494
- if (error.stderr) {
1495
- console.error(`${colors.dim}stderr:${colors.reset} ${error.stderr}`);
1496
- }
1497
- console.error(`\n${colors.dim}Full error:${colors.reset}`, JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
1498
- }
1486
+ // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1487
+ // console.error(`\n${colors.dim}Stack:${colors.reset} ${error.stack}`);
1488
+ // if (error.cause) {
1489
+ // console.error(`${colors.dim}Cause:${colors.reset} ${error.cause}`);
1490
+ // }
1491
+ // if (error.stdout) {
1492
+ // console.error(`${colors.dim}stdout:${colors.reset} ${error.stdout}`);
1493
+ // }
1494
+ // if (error.stderr) {
1495
+ // console.error(`${colors.dim}stderr:${colors.reset} ${error.stderr}`);
1496
+ // }
1497
+ // console.error(`\n${colors.dim}Full error:${colors.reset}`, JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
1498
+ // }
1499
1499
  } else {
1500
1500
  console.error(`${colors.red}${error}${colors.reset}`);
1501
1501
  }