@omen.foundation/node-microservice-runtime 0.1.90 → 0.1.92

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.90",
3
+ "version": "0.1.92",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -469,7 +469,16 @@ 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
+ }
477
+
472
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
+ }
473
482
  return explicitGamePid;
474
483
  }
475
484
 
@@ -477,16 +486,28 @@ async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
477
486
  try {
478
487
  const url = new URL(`/basic/realms/game`, apiHost);
479
488
  url.searchParams.set('rootPID', pid);
480
- const body = await fetchJson(url, {
481
- headers: {
482
- Authorization: `Bearer ${token}`,
483
- Accept: 'application/json',
484
- ...(scope ? { 'X-BEAM-SCOPE': scope } : {}),
485
- },
486
- });
489
+ const requestHeaders = {
490
+ Authorization: `Bearer ${token}`,
491
+ Accept: 'application/json',
492
+ ...(scope ? { 'X-BEAM-SCOPE': scope } : {}),
493
+ };
494
+
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
+ }
499
+
500
+ const body = await fetchJson(url, { headers: requestHeaders });
501
+
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
+ }
487
505
 
488
506
  const projects = Array.isArray(body?.projects) ? body.projects : [];
489
507
  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
+ }
490
511
  return pid;
491
512
  }
492
513
 
@@ -498,7 +519,10 @@ async function resolveGamePid(apiHost, token, cid, pid, explicitGamePid) {
498
519
  current = byPid.get(current.parent);
499
520
  }
500
521
  const resolved = current?.pid ?? pid;
501
- // Debug logging only
522
+
523
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
524
+ console.error(`[beamo-node] Resolved Game PID: ${resolved}`);
525
+ }
502
526
  return resolved;
503
527
  } catch (error) {
504
528
  // Debug logging only
@@ -1224,6 +1248,13 @@ async function main() {
1224
1248
  const inspect = await runCommand('docker', ['image', 'inspect', '--format', '{{.Id}}', dockerTag], { capture: true });
1225
1249
  const fullImageId = inspect.stdout.trim();
1226
1250
  const imageTarPath = path.join(tempRoot, `${serviceId.replace(/[^a-z0-9-_]/gi, '_')}.tar`);
1251
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1252
+ console.error(`[beamo-node] [STEP: Extract Image ID]`);
1253
+ console.error(`[beamo-node] Docker Tag: ${dockerTag}`);
1254
+ console.error(`[beamo-node] Full Image ID: ${fullImageId}`);
1255
+ console.error(`[beamo-node] Short Image ID: ${shortDigest(fullImageId)}`);
1256
+ console.error(`[beamo-node] Image Tar Path: ${imageTarPath}`);
1257
+ }
1227
1258
  await runCommand('docker', ['image', 'save', dockerTag, '-o', imageTarPath], { silent: true });
1228
1259
  progress.complete('Image prepared');
1229
1260