@adobe/helix-deploy 9.3.12 → 9.3.14

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,17 @@
1
+ ## [9.3.14](https://github.com/adobe/helix-deploy/compare/v9.3.13...v9.3.14) (2023-10-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update adobe fixes ([#613](https://github.com/adobe/helix-deploy/issues/613)) ([c183604](https://github.com/adobe/helix-deploy/commit/c183604fc2e0fa0c3d064240e4945fd0276ab5cc))
7
+
8
+ ## [9.3.13](https://github.com/adobe/helix-deploy/compare/v9.3.12...v9.3.13) (2023-10-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @adobe/fetch to v4.1.1 ([#612](https://github.com/adobe/helix-deploy/issues/612)) ([7bf12eb](https://github.com/adobe/helix-deploy/commit/7bf12eb6668ae27a4cada9679b23826245753c41))
14
+
1
15
  ## [9.3.12](https://github.com/adobe/helix-deploy/compare/v9.3.11...v9.3.12) (2023-10-28)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "9.3.12",
3
+ "version": "9.3.14",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/adobe/helix-deploy#readme",
@@ -36,8 +36,8 @@
36
36
  "@adobe/helix-universal": ">=4.1.1"
37
37
  },
38
38
  "dependencies": {
39
- "@adobe/fastly-native-promises": "3.0.5",
40
- "@adobe/fetch": "4.1.0",
39
+ "@adobe/fastly-native-promises": "3.0.6",
40
+ "@adobe/fetch": "4.1.1",
41
41
  "@aws-sdk/client-apigatewayv2": "3.438.0",
42
42
  "@aws-sdk/client-lambda": "3.438.0",
43
43
  "@aws-sdk/client-s3": "3.438.0",
@@ -69,9 +69,9 @@
69
69
  "yargs": "17.7.2"
70
70
  },
71
71
  "devDependencies": {
72
- "@adobe/eslint-config-helix": "2.0.3",
72
+ "@adobe/eslint-config-helix": "2.0.4",
73
73
  "@adobe/helix-shared-wrap": "2.0.0",
74
- "@adobe/helix-status": "10.0.10",
74
+ "@adobe/helix-status": "10.0.11",
75
75
  "@semantic-release/changelog": "6.0.3",
76
76
  "@semantic-release/git": "10.0.1",
77
77
  "c8": "8.0.1",
@@ -44,6 +44,7 @@ export default class EdgeBundler extends WebpackBundler {
44
44
  'aws-sdk',
45
45
  '@google-cloud/secret-manager',
46
46
  '@google-cloud/storage',
47
+ 'fastly:env',
47
48
  ].reduce((obj, ext) => {
48
49
  // this makes webpack to ignore the module and just leave it as normal require.
49
50
  // eslint-disable-next-line no-param-reassign
@@ -72,10 +72,10 @@ export default class ComputeAtEdgeDeployer extends BaseDeployer {
72
72
  # https://developer.fastly.com/reference/fastly-toml/
73
73
 
74
74
  authors = ["Helix Deploy"]
75
- description = "Test Project"
75
+ description = "${this.cfg.packageName} project generated by Helix Deploy"
76
76
  language = "javascript"
77
77
  manifest_version = 2
78
- name = "Test"
78
+ name = "${this.cfg.packageName}"
79
79
  service_id = ""
80
80
  `);
81
81
 
@@ -108,7 +108,7 @@ service_id = ""
108
108
  gzip: true,
109
109
  // sync: true,
110
110
  cwd: bundleDir,
111
- prefix: 'Test',
111
+ prefix: this.cfg.packageName,
112
112
  file,
113
113
  }, ['bin/main.wasm', 'fastly.toml']);
114
114
  this.log.debug(chalk`{green ok:} created tar file in ${bundleDir}/fastly-bundle.tar.gz`);
@@ -123,7 +123,7 @@ service_id = ""
123
123
  this.init();
124
124
 
125
125
  await this._fastly.transact(async (version) => {
126
- this.log.debug('--: uploading package to fastly');
126
+ this.log.debug('--: uploading package to fastly, service version', version);
127
127
  await this._fastly.writePackage(version, buf);
128
128
 
129
129
  this.log.debug('--: creating secrets dictionary');
@@ -12,9 +12,38 @@
12
12
  /* eslint-env serviceworker */
13
13
  /* global Dictionary */
14
14
 
15
+ export function getEnvInfo(req, env) {
16
+ const serviceVersion = env('FASTLY_SERVICE_VERSION');
17
+ const requestId = env('FASTLY_TRACE_ID');
18
+ const region = env('FASTLY_POP');
19
+ const functionName = env('FASTLY_SERVICE_ID');
20
+ const functionFQN = `${env('FASTLY_CUSTOMER_ID')}-${functionName}-${serviceVersion}`;
21
+ const txId = req.headers.get('x-transaction-id') ?? env('FASTLY_TRACE_ID');
22
+
23
+ console.debug('Env info sv: ', serviceVersion, ' reqId: ', requestId, ' region: ', region, ' functionName: ', functionName, ' functionFQN: ', functionFQN, ' txId: ', txId);
24
+
25
+ return {
26
+ functionFQN,
27
+ functionName,
28
+ region,
29
+ requestId,
30
+ serviceVersion,
31
+ txId,
32
+ };
33
+ }
34
+
35
+ async function getEnvironmentInfo(req) {
36
+ // The fastly:env import will be available in the fastly c@e environment
37
+ /* eslint-disable-next-line import/no-unresolved */
38
+ const mod = await import('fastly:env');
39
+ return getEnvInfo(req, mod.env);
40
+ }
41
+
15
42
  async function handler(event) {
16
43
  try {
17
44
  const { request } = event;
45
+ const env = await getEnvironmentInfo(request);
46
+
18
47
  console.log('Fastly Adapter is here');
19
48
  let packageParams;
20
49
  // eslint-disable-next-line import/no-unresolved,global-require
@@ -26,20 +55,20 @@ async function handler(event) {
26
55
  },
27
56
  runtime: {
28
57
  name: 'compute-at-edge',
29
- // region: request.cf.colo,
58
+ region: env.region,
30
59
  },
31
60
  func: {
32
- name: null,
61
+ name: env.functionName,
33
62
  package: null,
34
- version: null,
35
- fqn: null,
63
+ version: env.serviceVersion,
64
+ fqn: env.functionFQN,
36
65
  app: null,
37
66
  },
38
67
  invocation: {
39
68
  id: null,
40
69
  deadline: null,
41
- transactionId: null,
42
- requestId: null,
70
+ transactionId: env.txId,
71
+ requestId: env.requestId,
43
72
  },
44
73
  env: new Proxy(new Dictionary('secrets'), {
45
74
  get: (target, prop) => {
@@ -87,7 +116,7 @@ async function handler(event) {
87
116
  }
88
117
  }
89
118
 
90
- function fastly() {
119
+ export default function fastly() {
91
120
  console.log('checking for fastly environment');
92
121
  /* eslint-disable-next-line no-undef */
93
122
  if (CacheOverride) {
@@ -95,5 +124,3 @@ function fastly() {
95
124
  }
96
125
  return false;
97
126
  }
98
-
99
- module.exports = fastly;
@@ -10,7 +10,9 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  /* eslint-env serviceworker */
13
- const fastly = require('./fastly-adapter.js');
13
+
14
+ import fastly from './fastly-adapter.js';
15
+
14
16
  const cloudflare = require('./cloudflare-adapter.js');
15
17
 
16
18
  /* eslint-disable no-restricted-globals */