@omen.foundation/node-microservice-runtime 0.1.78 → 0.1.80

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.78",
3
+ "version": "0.1.80",
4
4
  "description": "Beamable microservice runtime for Node.js/TypeScript services.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -281,6 +281,19 @@ async function checkBlobExists(baseUrl, digest, headers) {
281
281
  return response.status === 200;
282
282
  }
283
283
 
284
+ async function verifyManifestExists(baseUrl, tag, headers) {
285
+ const url = new URL(`manifests/${tag}`, baseUrl);
286
+ const response = await fetch(url, { method: 'HEAD', headers, redirect: 'manual' });
287
+
288
+ if (response.status === 307 && response.headers.get('location')) {
289
+ const redirected = response.headers.get('location');
290
+ const nextBase = redirected.startsWith('http') ? redirected : new URL(redirected, baseUrl).href;
291
+ return verifyManifestExists(nextBase, tag, headers);
292
+ }
293
+
294
+ return response.status === 200;
295
+ }
296
+
284
297
  async function prepareUploadLocation(baseUrl, headers) {
285
298
  const url = new URL('blobs/uploads/', baseUrl);
286
299
  // Debug logging only - removed verbose output
@@ -679,7 +692,7 @@ async function updateManifest({
679
692
  cid,
680
693
  pid,
681
694
  serviceId,
682
- shortImageId,
695
+ shortImageId, // This is now the full image ID (sha256:...) for backend verification
683
696
  comments,
684
697
  existingManifest,
685
698
  discoveredStorage,
@@ -1083,9 +1096,28 @@ async function main() {
1083
1096
  });
1084
1097
  progress.complete('Image uploaded');
1085
1098
 
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
+
1086
1115
  // Step 7: Discover storage, components, and dependencies
1087
1116
  progress.start('Discovering storage objects and components');
1088
1117
  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
1089
1121
  const existingManifest = await fetchCurrentManifest(apiHost, token, cid, pid);
1090
1122
  const discoveredStorage = await discoverStorageObjects('src');
1091
1123
  const discoveredComponents = await discoverFederationComponents('src');
@@ -1105,7 +1137,7 @@ async function main() {
1105
1137
  cid,
1106
1138
  pid,
1107
1139
  serviceId,
1108
- shortImageId,
1140
+ shortImageId, // Use short hash - backend looks up by tag which matches registry tag
1109
1141
  comments: args.comments,
1110
1142
  existingManifest,
1111
1143
  discoveredStorage,