@adobe/aem-cli 16.4.0 → 16.5.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [16.5.0](https://github.com/adobe/helix-cli/compare/v16.4.0...v16.5.0) (2024-06-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * **security:** provide more troubleshooting instructions on `aem up` ([58d3403](https://github.com/adobe/helix-cli/commit/58d340337a2f443f21befede189657b71781abdd))
7
+
1
8
  # [16.4.0](https://github.com/adobe/helix-cli/compare/v16.3.26...v16.4.0) (2024-06-11)
2
9
 
3
10
 
package/README.md CHANGED
@@ -145,3 +145,27 @@ If present, `ALL_PROXY` is used as fallback if there is no other match.
145
145
  You can use `npm run check` to run the tests and check whether your code adheres
146
146
  to the aem-cli coding style.
147
147
 
148
+ # Troubleshooting
149
+
150
+ ## `aem up` fails with `unable to get local issuer certificate`
151
+
152
+ This error occurs when the server certificate is not trusted by Node.js. The typical
153
+ cause is that connections to the server `*.aem.page` and `*.hlx.page` are intercepted
154
+ by an enterprise proxy or firewall which is trying to inspect the traffic.
155
+
156
+ These proxies use a private certificate authority (CA) to sign the certificates of the
157
+ servers they intercept. To make Node.js trust the server certificate, you need to add
158
+ the CA certificate to the list of trusted CAs.
159
+
160
+ The CA certificate is typically provided by your IT department. You can ask them for
161
+ the CA certificate and save it to a file, e.g. `my-ca.crt`.
162
+
163
+ Then you can use the [`NODE_EXTRA_CA_CERTS`](https://nodejs.org/docs/latest/api/cli.html) environment variable to make Node.js trust
164
+ the CA certificate:
165
+
166
+ ```bash
167
+ export NODE_EXTRA_CA_CERTS=my-ca.crt
168
+ aem up
169
+ ```
170
+
171
+ This will make Node.js trust the server certificate and `aem up` should work.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aem-cli",
3
- "version": "16.4.0",
3
+ "version": "16.5.0",
4
4
  "description": "AEM CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -71,7 +71,7 @@
71
71
  "semver": "7.6.2",
72
72
  "shelljs": "0.8.5",
73
73
  "unified": "11.0.4",
74
- "uuid": "9.0.1",
74
+ "uuid": "10.0.0",
75
75
  "yargs": "17.7.2"
76
76
  },
77
77
  "devDependencies": {
@@ -80,7 +80,7 @@
80
80
  "@adobe/helix-testutils": "0.4.17",
81
81
  "@semantic-release/changelog": "6.0.3",
82
82
  "@semantic-release/git": "10.0.1",
83
- "c8": "9.1.0",
83
+ "c8": "10.0.0",
84
84
  "eslint": "8.57.0",
85
85
  "esmock": "2.6.5",
86
86
  "husky": "9.0.11",
package/src/up.cmd.js CHANGED
@@ -119,17 +119,30 @@ export default class UpCommand extends AbstractServerCommand {
119
119
  // "project": "Helix Website (AEM Live)",
120
120
  // "testProperty": "header";
121
121
  // }
122
- const configUrl = `https://admin.hlx.page/sidekick/${gitUrl.owner}/${gitUrl.repo}/main/config.json`;
123
- const configResp = await getFetch(this._allowInsecure)(configUrl);
124
122
  let previewHostBase = 'hlx.page';
125
- if (configResp.ok) {
123
+ const configUrl = `https://admin.hlx.page/sidekick/${gitUrl.owner}/${gitUrl.repo}/main/config.json`;
124
+ try {
125
+ const configResp = await getFetch(this._allowInsecure)(configUrl);
126
+ if (configResp.ok) {
126
127
  // this is best effort for now
127
- const config = await configResp.json();
128
- const { previewHost } = config;
129
- if (previewHost && previewHost.endsWith('.aem.page')) {
130
- previewHostBase = 'aem.page';
128
+ const config = await configResp.json();
129
+ const { previewHost } = config;
130
+ if (previewHost && previewHost.endsWith('.aem.page')) {
131
+ previewHostBase = 'aem.page';
132
+ }
133
+ }
134
+ /* c8 ignore start */
135
+ // this is notoriously hard to test, so we ignore it for now
136
+ // but if you want to give it a try, set up a local server with a self-signed cert
137
+ // change, /etc/hosts to point admin.hlx.page to localhost and run the test
138
+ } catch (e) {
139
+ if (e.code === 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY' || e.code === 'DEPTH_ZERO_SELF_SIGNED_CERT') {
140
+ await this.stop();
141
+ this.log.error(chalk`{yellow ${configUrl}} is using an invalid certificate, please check https://github.com/adobe/helix-cli#troubleshooting for help.`);
142
+ throw Error(e.message);
131
143
  }
132
144
  }
145
+ /* c8 ignore stop */
133
146
 
134
147
  const dnsName = `${ref.replace(/\//g, '-')}--${gitUrl.repo}--${gitUrl.owner}`;
135
148
  // check length limit