@salesforce/core 8.28.3 → 8.28.4

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/lib/org/org.js CHANGED
@@ -53,7 +53,7 @@ const authInfo_1 = require("./authInfo");
53
53
  const scratchOrgCreate_1 = require("./scratchOrgCreate");
54
54
  const orgConfigProperties_1 = require("./orgConfigProperties");
55
55
  ;
56
- const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["sandboxInfoRefreshFailed", "The sandbox org refresh failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."], ["FrontdoorURLError", "Failed to generate a frontdoor URL."], ["FlowIdNotFound", "ID not found for Flow %s."], ["CustomObjectIdNotFound", "ID not found for custom object %s."], ["ApexClassIdNotFound", "ID not found for Apex class %s."]]));
56
+ const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["sandboxInfoRefreshFailed", "The sandbox org refresh failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["sandboxAuthNotComplete", "The sandbox org completed successfully, but the local authentication file could not be written: %s. Run \"org resume sandbox\" again to retry authentication."], ["sandboxAuthIncomplete", "The sandbox org completed, but the authentication endpoint is not ready yet (INVALID_STATUS: %s). Run \"org resume sandbox\" to retry."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."], ["FrontdoorURLError", "Failed to generate a frontdoor URL."], ["FlowIdNotFound", "ID not found for Flow %s."], ["CustomObjectIdNotFound", "ID not found for custom object %s."], ["ApexClassIdNotFound", "ID not found for Apex class %s."]]));
57
57
  var OrgTypes;
58
58
  (function (OrgTypes) {
59
59
  OrgTypes["Scratch"] = "scratch";
@@ -405,7 +405,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
405
405
  return sandboxCreationProgress;
406
406
  }
407
407
  catch (err) {
408
- // eat the error, we don't want to throw an error if we can't write the file
408
+ const authError = err instanceof Error ? err : new Error(String(err));
409
+ this.logger.debug('Failed to write sandbox auth file', authError.message);
410
+ const sfError = messages.createError('sandboxAuthNotComplete', [authError.message]);
411
+ sfError.cause = authError;
412
+ throw sfError;
409
413
  }
410
414
  }
411
415
  }
@@ -1340,8 +1344,21 @@ class Org extends kit_1.AsyncOptionalCreatable {
1340
1344
  const pollingClient = await pollingClient_1.PollingClient.create({
1341
1345
  poll: async () => {
1342
1346
  const sandboxProcessObj = await this.querySandboxProcessById(options.sandboxProcessObj.Id);
1343
- // check to see if sandbox can authenticate via sandboxAuth endpoint
1344
- const sandboxInfo = await this.sandboxSignupComplete(sandboxProcessObj);
1347
+ let sandboxInfo;
1348
+ try {
1349
+ // check to see if sandbox can authenticate via sandboxAuth endpoint
1350
+ sandboxInfo = await this.sandboxSignupComplete(sandboxProcessObj);
1351
+ }
1352
+ catch (err) {
1353
+ const error = err instanceof Error ? err : sfError_1.SfError.wrap((0, ts_types_1.isString)(err) ? err : 'unknown');
1354
+ if (error.name === 'SandboxAuthIncompleteError') {
1355
+ this.logger.debug('Sandbox auth returned INVALID_STATUS, will retry', error.message);
1356
+ waitingOnAuth = true;
1357
+ }
1358
+ else {
1359
+ throw error;
1360
+ }
1361
+ }
1345
1362
  if (sandboxInfo) {
1346
1363
  await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_AUTH, sandboxInfo);
1347
1364
  try {
@@ -1433,11 +1450,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
1433
1450
  // In that case, the sandboxAuth call will throw a specific exception.
1434
1451
  if (error?.name === 'INVALID_STATUS') {
1435
1452
  this.logger.debug('Error while authenticating the user:', error.message);
1453
+ const sfError = messages.createError('sandboxAuthIncomplete', [error.message]);
1454
+ sfError.cause = error;
1455
+ throw sfError;
1436
1456
  }
1437
- else {
1438
- // If it fails for any unexpected reason, rethrow
1439
- throw error;
1440
- }
1457
+ throw error;
1441
1458
  }
1442
1459
  }
1443
1460
  validateWaitOptions(options) {
package/messages/org.md CHANGED
@@ -58,6 +58,14 @@ AuthInfo orgId is undefined.
58
58
 
59
59
  The sandbox creation has not completed.
60
60
 
61
+ # sandboxAuthNotComplete
62
+
63
+ The sandbox org completed successfully, but the local authentication file could not be written: %s. Run "org resume sandbox" again to retry authentication.
64
+
65
+ # sandboxAuthIncomplete
66
+
67
+ The sandbox org completed, but the authentication endpoint is not ready yet (INVALID_STATUS: %s). Run "org resume sandbox" to retry.
68
+
61
69
  # SandboxProcessNotFoundBySandboxName
62
70
 
63
71
  We can't find a SandboxProcess with the SandboxName %s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.28.3",
3
+ "version": "8.28.4",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",