@omen.foundation/node-microservice-runtime 0.1.108 → 0.1.110

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.108",
3
+ "version": "0.1.110",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1102,11 +1102,6 @@ async function updateManifest({
1102
1102
  storageReferences: storageReferences.length > 0 ? storageReferences : null,
1103
1103
  };
1104
1104
 
1105
- // Log full request body structure to verify format
1106
- if (storageReferences.length > 0) {
1107
- console.log(`[beamo-node] Request body includes storageReferences: ${storageReferences.length} reference(s)`);
1108
- }
1109
-
1110
1105
  const publishUrl = new URL('/basic/beamo/manifest', apiHost);
1111
1106
  const publishHeaders = {
1112
1107
  Authorization: `Bearer ${token}`,
@@ -1115,23 +1110,17 @@ async function updateManifest({
1115
1110
  'X-BEAM-SCOPE': `${cid}.${pid}`,
1116
1111
  };
1117
1112
 
1118
- // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1119
- // console.error(`[beamo-node] [STEP: Publish Manifest to Backend]`);
1120
- // console.error(`[beamo-node] URL: ${publishUrl}`);
1121
- // console.error(`[beamo-node] Method: POST`);
1122
- // console.error(`[beamo-node] Headers:`, JSON.stringify(publishHeaders, null, 2));
1123
- // console.error(`[beamo-node] Service: ${serviceId}`);
1124
- // console.error(`[beamo-node] CID: ${cid}`);
1125
- // console.error(`[beamo-node] Realm PID (from X-BEAM-SCOPE): ${pid}`);
1126
- // console.error(`[beamo-node] Short Image ID: ${shortImageId}`);
1127
- // console.error(`[beamo-node] Expected Backend Check:`);
1128
- // console.error(`[beamo-node] - Backend will calculate imageNameMD5 using: rc.cid, rc.gameId, serviceName`);
1129
- // console.error(`[beamo-node] - Backend will check: {registryURI}/{imageNameMD5}/manifests/{imageId}`);
1130
- // console.error(`[beamo-node] - Backend will use headers: X-KS-PROJECTID: rc.projectId (from X-BEAM-SCOPE)`);
1131
- // console.error(`[beamo-node] - NOTE: rc.gameId might differ from realm PID if backend resolves it differently`);
1132
- // console.error(`[beamo-node] Request Body:`, JSON.stringify(requestBody, null, 2));
1133
- // console.error(`[beamo-node] Service Entry in Manifest:`, JSON.stringify(mappedServices.find(s => s.serviceName === serviceId), null, 2));
1134
- // }
1113
+ // Always log the full manifest being sent for debugging
1114
+ console.log(`\n=== MANIFEST BEING SENT TO BACKEND ===`);
1115
+ console.log(`URL: ${publishUrl}`);
1116
+ console.log(`Method: POST`);
1117
+ console.log(`Headers:`, JSON.stringify(publishHeaders, null, 2));
1118
+ console.log(`\nFull Request Body:`);
1119
+ console.log(JSON.stringify(requestBody, null, 2));
1120
+ console.log(`\nService Entry in Manifest:`);
1121
+ const serviceEntry = mappedServices.find(s => s.serviceName === serviceId);
1122
+ console.log(JSON.stringify(serviceEntry, null, 2));
1123
+ console.log(`=== END MANIFEST ===\n`);
1135
1124
 
1136
1125
  const response = await fetch(publishUrl, {
1137
1126
  method: 'POST',
@@ -1146,18 +1135,49 @@ async function updateManifest({
1146
1135
 
1147
1136
  if (!response.ok) {
1148
1137
  const text = await response.text();
1149
- // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1150
- // console.error(`[beamo-node] Response Body: ${text}`);
1151
- // console.error(`[beamo-node] Full Request Body (for debugging):`, JSON.stringify(requestBody, null, 2));
1152
- // }
1138
+ console.error(`\n${colors.red}✗${colors.reset} Failed to publish manifest: ${response.status}`);
1139
+ console.error(`Response: ${text}`);
1153
1140
  throw new Error(`Failed to publish manifest: ${response.status} ${text}`);
1154
1141
  }
1155
1142
 
1156
1143
  const responseBody = await response.json();
1157
- // if (process.env.BEAMO_DEBUG === '1' || process.env.BEAMO_NODE_DEBUG === '1') {
1158
- // console.error(`[beamo-node] Response Body:`, JSON.stringify(responseBody, null, 2));
1159
- // console.error(`[beamo-node] ✓ Manifest published successfully`);
1160
- // }
1144
+ console.log(`\n${colors.green}✓${colors.reset} Manifest published successfully`);
1145
+ console.log(`${colors.dim}Backend Response:${colors.reset}`, JSON.stringify(responseBody, null, 2));
1146
+
1147
+ // After publishing, fetch the current manifest to see what was stored
1148
+ // Note: ManifestView doesn't include storageGroupId, but we can at least verify storageReferences
1149
+ try {
1150
+ const currentManifestUrl = new URL('/basic/beamo/manifest/current', apiHost);
1151
+ const currentManifestResponse = await fetch(currentManifestUrl, {
1152
+ method: 'GET',
1153
+ headers: {
1154
+ Authorization: `Bearer ${token}`,
1155
+ Accept: 'application/json',
1156
+ 'X-BEAM-SCOPE': `${cid}.${pid}`,
1157
+ },
1158
+ });
1159
+
1160
+ if (currentManifestResponse.ok) {
1161
+ const currentManifest = await currentManifestResponse.json();
1162
+ console.log(`\n${colors.cyan}=== CURRENT MANIFEST (as stored in backend) ===${colors.reset}`);
1163
+ console.log(JSON.stringify(currentManifest, null, 2));
1164
+ console.log(`${colors.cyan}=== END CURRENT MANIFEST ===${colors.reset}\n`);
1165
+
1166
+ // Check if storage references are present
1167
+ if (currentManifest?.manifest?.storageReference) {
1168
+ console.log(`${colors.green}✓${colors.reset} Storage references found in stored manifest: ${currentManifest.manifest.storageReference.length} reference(s)`);
1169
+ currentManifest.manifest.storageReference.forEach(sr => {
1170
+ console.log(` - ${sr.id}: type=${sr.storageType}, enabled=${sr.enabled}, templateId=${sr.templateId || 'N/A'}, archived=${sr.archived || false}`);
1171
+ });
1172
+ } else {
1173
+ console.log(`${colors.yellow}⚠${colors.reset} No storage references found in stored manifest`);
1174
+ }
1175
+ } else {
1176
+ console.log(`${colors.yellow}⚠${colors.reset} Could not fetch current manifest: ${currentManifestResponse.status}`);
1177
+ }
1178
+ } catch (err) {
1179
+ console.log(`${colors.yellow}⚠${colors.reset} Could not fetch current manifest: ${err.message}`);
1180
+ }
1161
1181
  }
1162
1182
 
1163
1183
  async function prepareDockerContext({ entry, distDir, openapiPath, packageJson, packageLock, nodeVersion }) {