@salesforce/core 5.3.18 → 5.3.20

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.
@@ -71,6 +71,7 @@ class Logger {
71
71
  * `Logger`.
72
72
  */
73
73
  constructor(optionsOrName) {
74
+ const enabled = process.env.SFDX_DISABLE_LOG_FILE !== 'true' && process.env.SF_DISABLE_LOG_FILE !== 'true';
74
75
  const options = typeof optionsOrName === 'string'
75
76
  ? { name: optionsOrName, level: Logger.DEFAULT_LEVEL, fields: {} }
76
77
  : optionsOrName;
@@ -89,9 +90,9 @@ class Logger {
89
90
  name: options.name ?? Logger.ROOT_NAME,
90
91
  base: options.fields ?? {},
91
92
  level,
92
- enabled: process.env.SFDX_DISABLE_LOG_FILE !== 'true' && process.env.SF_DISABLE_LOG_FILE !== 'true',
93
+ enabled,
93
94
  };
94
- if (options.useMemoryLogger || global_1.Global.getEnvironmentMode() === global_1.Mode.TEST) {
95
+ if (options.useMemoryLogger || global_1.Global.getEnvironmentMode() === global_1.Mode.TEST || !enabled) {
95
96
  this.memoryLogger = new memoryLogger_1.MemoryLogger();
96
97
  this.pinoLogger = (0, pino_1.pino)({
97
98
  ...commonOptions,
package/lib/org/org.js CHANGED
@@ -28,7 +28,7 @@ const connection_1 = require("./connection");
28
28
  const authInfo_1 = require("./authInfo");
29
29
  const scratchOrgCreate_1 = require("./scratchOrgCreate");
30
30
  const orgConfigProperties_1 = require("./orgConfigProperties");
31
- 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."], ["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."]]));
31
+ 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."], ["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."], ["UnexpectedResponse", "Unexpected response from the platform"], ["UnexpectedResponse.actions", ["Check that the instance URL is correct and the org still exists.", "See what's at the URL that's causing the problem: %s."]]]));
32
32
  var OrgTypes;
33
33
  (function (OrgTypes) {
34
34
  OrgTypes["Scratch"] = "scratch";
@@ -546,7 +546,17 @@ class Org extends kit_1.AsyncOptionalCreatable {
546
546
  method: 'GET',
547
547
  };
548
548
  const conn = this.getConnection();
549
- await conn.request(requestInfo);
549
+ try {
550
+ await conn.request(requestInfo);
551
+ }
552
+ catch (e) {
553
+ // an html error page like https://computing-connect-6970-dev-ed.scratch.my.salesforce.com/services/data/v50.0
554
+ // where the message is an entire html page
555
+ if (e instanceof Error && (e.name.includes('ERROR_HTTP') || e.message.includes('<html '))) {
556
+ throw messages.createError('UnexpectedResponse', [], [conn.baseUrl()], e);
557
+ }
558
+ throw e;
559
+ }
550
560
  }
551
561
  /**
552
562
  * Reads and returns the content of all user auth files for this org as an array.
package/messages/org.md CHANGED
@@ -65,3 +65,13 @@ We found more than one SandboxProcess with the SandboxName %s.
65
65
  # sandboxNotResumable
66
66
 
67
67
  The sandbox %s cannot resume with status of %s.
68
+
69
+ # UnexpectedResponse
70
+
71
+ Unexpected response from the platform
72
+
73
+ # UnexpectedResponse.actions
74
+
75
+ - Check that the instance URL is correct and the org still exists.
76
+
77
+ - See what's at the URL that's causing the problem: %s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "5.3.18",
3
+ "version": "5.3.20",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -64,7 +64,7 @@
64
64
  "@salesforce/prettier-config": "^0.0.3",
65
65
  "@salesforce/ts-sinon": "^1.4.18",
66
66
  "@types/benchmark": "^2.1.3",
67
- "@types/chai-string": "^1.4.3",
67
+ "@types/chai-string": "^1.4.4",
68
68
  "@types/jsonwebtoken": "9.0.3",
69
69
  "@types/lodash": "^4.14.200",
70
70
  "@types/proper-lockfile": "^4.1.2",
@@ -74,7 +74,7 @@
74
74
  "benchmark": "^2.1.4",
75
75
  "chai": "^4.3.10",
76
76
  "chai-string": "^1.5.0",
77
- "eslint": "^8.52.0",
77
+ "eslint": "^8.53.0",
78
78
  "eslint-config-prettier": "^8.10.0",
79
79
  "eslint-config-salesforce": "^2.0.2",
80
80
  "eslint-config-salesforce-license": "^0.2.0",