@omen.foundation/node-microservice-runtime 0.1.93 → 0.1.95
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 +1 -1
- package/scripts/publish-service.mjs +46 -4
package/package.json
CHANGED
|
@@ -1015,8 +1015,13 @@ async function updateManifest({
|
|
|
1015
1015
|
console.error(`[beamo-node] Headers:`, JSON.stringify(publishHeaders, null, 2));
|
|
1016
1016
|
console.error(`[beamo-node] Service: ${serviceId}`);
|
|
1017
1017
|
console.error(`[beamo-node] CID: ${cid}`);
|
|
1018
|
-
console.error(`[beamo-node] PID: ${pid}`);
|
|
1018
|
+
console.error(`[beamo-node] Realm PID (from X-BEAM-SCOPE): ${pid}`);
|
|
1019
1019
|
console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
|
|
1020
|
+
console.error(`[beamo-node] Expected Backend Check:`);
|
|
1021
|
+
console.error(`[beamo-node] - Backend will calculate imageNameMD5 using: rc.cid, rc.gameId, serviceName`);
|
|
1022
|
+
console.error(`[beamo-node] - Backend will check: {registryURI}/{imageNameMD5}/manifests/{imageId}`);
|
|
1023
|
+
console.error(`[beamo-node] - Backend will use headers: X-KS-PROJECTID: rc.projectId (from X-BEAM-SCOPE)`);
|
|
1024
|
+
console.error(`[beamo-node] - NOTE: rc.gameId might differ from realm PID if backend resolves it differently`);
|
|
1020
1025
|
console.error(`[beamo-node] Request Body:`, JSON.stringify(requestBody, null, 2));
|
|
1021
1026
|
console.error(`[beamo-node] Service Entry in Manifest:`, JSON.stringify(mappedServices.find(s => s.serviceName === serviceId), null, 2));
|
|
1022
1027
|
}
|
|
@@ -1284,8 +1289,8 @@ async function main() {
|
|
|
1284
1289
|
}
|
|
1285
1290
|
}
|
|
1286
1291
|
|
|
1287
|
-
//
|
|
1288
|
-
//
|
|
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
|
|
1289
1294
|
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
1290
1295
|
console.error(`[beamo-node] [STEP: Calculate Registry Path]`);
|
|
1291
1296
|
console.error(`[beamo-node] CID: ${cid}`);
|
|
@@ -1293,7 +1298,7 @@ async function main() {
|
|
|
1293
1298
|
console.error(`[beamo-node] Resolved Game PID: ${resolvedGamePid}`);
|
|
1294
1299
|
console.error(`[beamo-node] Service ID: ${serviceId}`);
|
|
1295
1300
|
}
|
|
1296
|
-
const registryUrl = await getRegistryUrl(apiHost, token, cid,
|
|
1301
|
+
const registryUrl = await getRegistryUrl(apiHost, token, cid, pid);
|
|
1297
1302
|
const uniqueNameInput = `${cid}_${resolvedGamePid}_${serviceId}`;
|
|
1298
1303
|
const uniqueName = md5Hex(uniqueNameInput).substring(0, 30);
|
|
1299
1304
|
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
@@ -1352,6 +1357,43 @@ async function main() {
|
|
|
1352
1357
|
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
1353
1358
|
console.error(`[beamo-node] ✓ Image verification passed`);
|
|
1354
1359
|
}
|
|
1360
|
+
|
|
1361
|
+
// CRITICAL: Before publishing, verify using the backend's expected gameId
|
|
1362
|
+
// The backend resolves rc.gameId from the realm hierarchy, which might differ from our resolvedGamePid
|
|
1363
|
+
// We need to check what the backend will actually use
|
|
1364
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
1365
|
+
console.error(`[beamo-node] [STEP: Pre-Publish Backend Simulation]`);
|
|
1366
|
+
console.error(`[beamo-node] Simulating backend's imageNameMD5 calculation...`);
|
|
1367
|
+
console.error(`[beamo-node] Backend will use: rc.cid, rc.gameId (resolved from realm hierarchy), serviceName`);
|
|
1368
|
+
console.error(`[beamo-node] Our calculation used: cid=${cid}, gamePid=${resolvedGamePid}, serviceName=${serviceId}`);
|
|
1369
|
+
console.error(`[beamo-node] Our uniqueName: ${uniqueName}`);
|
|
1370
|
+
console.error(`[beamo-node] WARNING: If backend's rc.gameId differs from our resolvedGamePid, the check will fail!`);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// Try to resolve what the backend's rc.gameId will be by making the same API call the backend would make
|
|
1374
|
+
// The backend resolves gameId from the realm hierarchy when processing X-BEAM-SCOPE
|
|
1375
|
+
try {
|
|
1376
|
+
const backendGamePidCheck = await resolveGamePid(apiHost, token, cid, pid, null); // Force resolution
|
|
1377
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
1378
|
+
console.error(`[beamo-node] Backend's expected gameId (resolved from realm hierarchy): ${backendGamePidCheck}`);
|
|
1379
|
+
if (backendGamePidCheck !== resolvedGamePid) {
|
|
1380
|
+
console.error(`[beamo-node] ⚠️ MISMATCH DETECTED!`);
|
|
1381
|
+
console.error(`[beamo-node] Our resolvedGamePid: ${resolvedGamePid}`);
|
|
1382
|
+
console.error(`[beamo-node] Backend's expected gameId: ${backendGamePidCheck}`);
|
|
1383
|
+
console.error(`[beamo-node] This will cause imageNameMD5 mismatch!`);
|
|
1384
|
+
const backendUniqueNameInput = `${cid}_${backendGamePidCheck}_${serviceId}`;
|
|
1385
|
+
const backendUniqueName = md5Hex(backendUniqueNameInput).substring(0, 30);
|
|
1386
|
+
console.error(`[beamo-node] Backend will check: ${registryUrl}${backendUniqueName}/manifests/${shortImageId}`);
|
|
1387
|
+
console.error(`[beamo-node] But we uploaded to: ${registryUrl}${uniqueName}/manifests/${shortImageId}`);
|
|
1388
|
+
} else {
|
|
1389
|
+
console.error(`[beamo-node] ✓ Game PID matches - backend should find the image`);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
} catch (error) {
|
|
1393
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
1394
|
+
console.error(`[beamo-node] Could not verify backend gameId resolution: ${error.message}`);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1355
1397
|
|
|
1356
1398
|
// Step 7: Discover storage, components, and dependencies
|
|
1357
1399
|
progress.start('Discovering storage objects and components');
|