@omen.foundation/node-microservice-runtime 0.1.80 → 0.1.82
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 +26 -22
package/package.json
CHANGED
|
@@ -510,11 +510,16 @@ async function uploadDockerImage({
|
|
|
510
510
|
}) {
|
|
511
511
|
const baseUrl = `${registryUrl}${uniqueName}/`;
|
|
512
512
|
// Match C# CLI exactly: use x-ks-* headers (all lowercase) with CID, PID (realm PID), and access token
|
|
513
|
+
// Note: Backend might check using gamePid, but C# CLI uses realm PID for upload headers
|
|
513
514
|
const headers = {
|
|
514
515
|
'x-ks-clientid': cid,
|
|
515
516
|
'x-ks-projectid': pid, // Use realm PID (not gamePid) - matches ctx.Pid in C# CLI
|
|
516
517
|
'x-ks-token': token, // Access token from login
|
|
517
518
|
};
|
|
519
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
520
|
+
console.error(`[beamo-node] Uploading to: ${baseUrl}`);
|
|
521
|
+
console.error(`[beamo-node] Upload headers PID: ${pid} (realm), gamePid: ${gamePid}`);
|
|
522
|
+
}
|
|
518
523
|
|
|
519
524
|
const { manifestEntry, configBuffer, layers } = await readDockerImageTar(imageTarPath);
|
|
520
525
|
|
|
@@ -847,6 +852,12 @@ async function updateManifest({
|
|
|
847
852
|
storageReferences,
|
|
848
853
|
};
|
|
849
854
|
|
|
855
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
856
|
+
console.error(`[beamo-node] Publishing manifest with imageId: ${shortImageId}`);
|
|
857
|
+
console.error(`[beamo-node] Service: ${serviceId}, CID: ${cid}, PID: ${pid}`);
|
|
858
|
+
console.error(`[beamo-node] Manifest service entry:`, JSON.stringify(mappedServices.find(s => s.serviceName === serviceId), null, 2));
|
|
859
|
+
}
|
|
860
|
+
|
|
850
861
|
const response = await fetch(new URL('/api/beamo/manifests', apiHost), {
|
|
851
862
|
method: 'POST',
|
|
852
863
|
headers: {
|
|
@@ -860,6 +871,11 @@ async function updateManifest({
|
|
|
860
871
|
|
|
861
872
|
if (!response.ok) {
|
|
862
873
|
const text = await response.text();
|
|
874
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
875
|
+
console.error(`[beamo-node] Manifest publish failed: ${response.status}`);
|
|
876
|
+
console.error(`[beamo-node] Response: ${text}`);
|
|
877
|
+
console.error(`[beamo-node] Request body:`, JSON.stringify(requestBody, null, 2));
|
|
878
|
+
}
|
|
863
879
|
throw new Error(`Failed to publish manifest: ${response.status} ${text}`);
|
|
864
880
|
}
|
|
865
881
|
}
|
|
@@ -1075,8 +1091,15 @@ async function main() {
|
|
|
1075
1091
|
}
|
|
1076
1092
|
}
|
|
1077
1093
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1094
|
+
// Try using realm PID for registry URL (backend might check using realm PID scope)
|
|
1095
|
+
// If resolvedGamePid differs from pid, the backend might be checking with the wrong scope
|
|
1096
|
+
const registryUrl = await getRegistryUrl(apiHost, token, cid, pid);
|
|
1097
|
+
const uniqueName = md5Hex(`${cid}_${pid}_${serviceId}`).substring(0, 30);
|
|
1098
|
+
if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
|
|
1099
|
+
console.error(`[beamo-node] Registry URL: ${registryUrl}`);
|
|
1100
|
+
console.error(`[beamo-node] Unique name: ${uniqueName}`);
|
|
1101
|
+
console.error(`[beamo-node] CID: ${cid}, PID: ${pid}, Game PID: ${resolvedGamePid}`);
|
|
1102
|
+
}
|
|
1080
1103
|
progress.complete('Authenticated');
|
|
1081
1104
|
|
|
1082
1105
|
// Step 6: Upload Docker image
|
|
@@ -1096,28 +1119,9 @@ async function main() {
|
|
|
1096
1119
|
});
|
|
1097
1120
|
progress.complete('Image uploaded');
|
|
1098
1121
|
|
|
1099
|
-
// Verify image exists in registry before proceeding
|
|
1100
|
-
const shortImageIdForVerify = shortDigest(fullImageId);
|
|
1101
|
-
const baseUrl = `${registryUrl}${uniqueName}/`;
|
|
1102
|
-
const verifyHeaders = {
|
|
1103
|
-
'x-ks-clientid': cid,
|
|
1104
|
-
'x-ks-projectid': pid,
|
|
1105
|
-
'x-ks-token': token,
|
|
1106
|
-
};
|
|
1107
|
-
|
|
1108
|
-
// Wait a moment for registry to propagate, then verify
|
|
1109
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1110
|
-
const imageExists = await verifyManifestExists(baseUrl, shortImageIdForVerify, verifyHeaders);
|
|
1111
|
-
if (!imageExists) {
|
|
1112
|
-
throw new Error(`Image verification failed: manifest with tag ${shortImageIdForVerify} not found in registry at ${baseUrl}. The image may not have uploaded successfully.`);
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
1122
|
// Step 7: Discover storage, components, and dependencies
|
|
1116
1123
|
progress.start('Discovering storage objects and components');
|
|
1117
1124
|
const shortImageId = shortDigest(fullImageId);
|
|
1118
|
-
// The backend looks up images using the short imageId tag (matches registry tag)
|
|
1119
|
-
// Add a small delay to ensure registry has propagated the image before backend checks
|
|
1120
|
-
await new Promise(resolve => setTimeout(resolve, 2000)); // 2 second delay
|
|
1121
1125
|
const existingManifest = await fetchCurrentManifest(apiHost, token, cid, pid);
|
|
1122
1126
|
const discoveredStorage = await discoverStorageObjects('src');
|
|
1123
1127
|
const discoveredComponents = await discoverFederationComponents('src');
|
|
@@ -1137,7 +1141,7 @@ async function main() {
|
|
|
1137
1141
|
cid,
|
|
1138
1142
|
pid,
|
|
1139
1143
|
serviceId,
|
|
1140
|
-
shortImageId,
|
|
1144
|
+
shortImageId,
|
|
1141
1145
|
comments: args.comments,
|
|
1142
1146
|
existingManifest,
|
|
1143
1147
|
discoveredStorage,
|