@omen.foundation/node-microservice-runtime 0.1.94 → 0.1.96

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.94",
3
+ "version": "0.1.96",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1289,8 +1289,8 @@ async function main() {
1289
1289
  }
1290
1290
  }
1291
1291
 
1292
- // Use resolvedGamePid for registry URL and uniqueName - backend checks using game PID scope
1293
- // The pid variable might be a realm PID, but the backend expects game PID for registry operations
1292
+ // Match C# CLI: GetDockerImageRegistryUri() uses realm PID from context (X-BEAM-SCOPE)
1293
+ // uniqueName uses gamePid (matches backend's rc.gameId), but registry URL uses realm PID
1294
1294
  if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1295
1295
  console.error(`[beamo-node] [STEP: Calculate Registry Path]`);
1296
1296
  console.error(`[beamo-node] CID: ${cid}`);
@@ -1298,7 +1298,7 @@ async function main() {
1298
1298
  console.error(`[beamo-node] Resolved Game PID: ${resolvedGamePid}`);
1299
1299
  console.error(`[beamo-node] Service ID: ${serviceId}`);
1300
1300
  }
1301
- const registryUrl = await getRegistryUrl(apiHost, token, cid, resolvedGamePid);
1301
+ const registryUrl = await getRegistryUrl(apiHost, token, cid, pid);
1302
1302
  const uniqueNameInput = `${cid}_${resolvedGamePid}_${serviceId}`;
1303
1303
  const uniqueName = md5Hex(uniqueNameInput).substring(0, 30);
1304
1304
  if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
@@ -1357,6 +1357,69 @@ async function main() {
1357
1357
  if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1358
1358
  console.error(`[beamo-node] ✓ Image verification passed`);
1359
1359
  }
1360
+
1361
+ // CRITICAL: Perform exact backend check simulation
1362
+ // The backend uses HEAD request with specific headers - let's verify it works
1363
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1364
+ console.error(`[beamo-node] [STEP: Backend Check Simulation]`);
1365
+ console.error(`[beamo-node] Simulating exact backend check...`);
1366
+ const backendCheckUrl = `${registryUrl}${uniqueName}/manifests/${shortImageId}`;
1367
+ console.error(`[beamo-node] Backend will check: ${backendCheckUrl}`);
1368
+ console.error(`[beamo-node] Backend will use headers:`, JSON.stringify(verifyHeaders, null, 2));
1369
+ try {
1370
+ const backendCheckResponse = await fetch(backendCheckUrl, {
1371
+ method: 'HEAD',
1372
+ headers: verifyHeaders,
1373
+ });
1374
+ console.error(`[beamo-node] Backend simulation response status: ${backendCheckResponse.status}`);
1375
+ if (backendCheckResponse.status !== 200) {
1376
+ console.error(`[beamo-node] ⚠️ Backend simulation FAILED - status ${backendCheckResponse.status}`);
1377
+ const responseText = await backendCheckResponse.text().catch(() => '');
1378
+ console.error(`[beamo-node] Response: ${responseText}`);
1379
+ } else {
1380
+ console.error(`[beamo-node] ✓ Backend simulation passed`);
1381
+ }
1382
+ } catch (error) {
1383
+ console.error(`[beamo-node] ⚠️ Backend simulation error: ${error.message}`);
1384
+ }
1385
+ }
1386
+
1387
+ // CRITICAL: Before publishing, verify using the backend's expected gameId
1388
+ // The backend resolves rc.gameId from the realm hierarchy, which might differ from our resolvedGamePid
1389
+ // We need to check what the backend will actually use
1390
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1391
+ console.error(`[beamo-node] [STEP: Pre-Publish Backend Simulation]`);
1392
+ console.error(`[beamo-node] Simulating backend's imageNameMD5 calculation...`);
1393
+ console.error(`[beamo-node] Backend will use: rc.cid, rc.gameId (resolved from realm hierarchy), serviceName`);
1394
+ console.error(`[beamo-node] Our calculation used: cid=${cid}, gamePid=${resolvedGamePid}, serviceName=${serviceId}`);
1395
+ console.error(`[beamo-node] Our uniqueName: ${uniqueName}`);
1396
+ console.error(`[beamo-node] WARNING: If backend's rc.gameId differs from our resolvedGamePid, the check will fail!`);
1397
+ }
1398
+
1399
+ // Try to resolve what the backend's rc.gameId will be by making the same API call the backend would make
1400
+ // The backend resolves gameId from the realm hierarchy when processing X-BEAM-SCOPE
1401
+ try {
1402
+ const backendGamePidCheck = await resolveGamePid(apiHost, token, cid, pid, null); // Force resolution
1403
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1404
+ console.error(`[beamo-node] Backend's expected gameId (resolved from realm hierarchy): ${backendGamePidCheck}`);
1405
+ if (backendGamePidCheck !== resolvedGamePid) {
1406
+ console.error(`[beamo-node] ⚠️ MISMATCH DETECTED!`);
1407
+ console.error(`[beamo-node] Our resolvedGamePid: ${resolvedGamePid}`);
1408
+ console.error(`[beamo-node] Backend's expected gameId: ${backendGamePidCheck}`);
1409
+ console.error(`[beamo-node] This will cause imageNameMD5 mismatch!`);
1410
+ const backendUniqueNameInput = `${cid}_${backendGamePidCheck}_${serviceId}`;
1411
+ const backendUniqueName = md5Hex(backendUniqueNameInput).substring(0, 30);
1412
+ console.error(`[beamo-node] Backend will check: ${registryUrl}${backendUniqueName}/manifests/${shortImageId}`);
1413
+ console.error(`[beamo-node] But we uploaded to: ${registryUrl}${uniqueName}/manifests/${shortImageId}`);
1414
+ } else {
1415
+ console.error(`[beamo-node] ✓ Game PID matches - backend should find the image`);
1416
+ }
1417
+ }
1418
+ } catch (error) {
1419
+ if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1420
+ console.error(`[beamo-node] Could not verify backend gameId resolution: ${error.message}`);
1421
+ }
1422
+ }
1360
1423
 
1361
1424
  // Step 7: Discover storage, components, and dependencies
1362
1425
  progress.start('Discovering storage objects and components');