@adobe/helix-deploy 9.3.6 → 9.3.8

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/AWS.md CHANGED
@@ -78,3 +78,112 @@ The is no automatic installation of the proxy functions (yet).
78
78
 
79
79
  [invoke]: https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html
80
80
 
81
+ ## Getting started with `hedy` on AWS
82
+
83
+ ### 1. Create a Starter Project
84
+ Create a simple JavaScript starter project.
85
+
86
+ src/index.js:
87
+
88
+ ```
89
+ const { Response } = require('@adobe/fetch');
90
+
91
+ /**
92
+ * This is the main function
93
+ * @param {Request} req Universal API Request
94
+ * @param {HEDYContext} context Universal API Context
95
+ * @returns {Response} a status response
96
+ */
97
+ module.exports.main = async function main(req, context) {
98
+ const result = '{"result": "it works!"}';
99
+ return new Response(result, {
100
+ status: 200,
101
+ });
102
+ }
103
+ ```
104
+
105
+ package.json:
106
+ ```
107
+ {
108
+ "name": "my-project",
109
+ "version": "1.0",
110
+ "private": true,
111
+ "main": "src/index.js",
112
+ "dependencies": {
113
+ "@adobe/fetch": "4.1.0"
114
+ }
115
+ }
116
+ ```
117
+
118
+ Build the project with `npm i`
119
+
120
+
121
+ ### 2. Configure your AWS account
122
+
123
+ Its useful to install the AWS Command Line Interface. See [Install or update the latest version of the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
124
+ If you're on MacOS you can just use `brew install awscli`.
125
+
126
+ * Go to the [AWS UI](https://aws.amazon.com/) and in Secrets Manager create a secret called `/helix-deploy/default/all` you can enter a dummy key and value
127
+ for the secret and use the default values with everything else.
128
+ <img width="1094" alt="secret" src="docs/images/secret.png">
129
+
130
+ * Copy your account number from the top right of the console
131
+ <img width="237" alt="acc_id" src="docs/images/acc_id.png">
132
+
133
+ * ... and create an associated S3 bucket named `helix-deploy-bucket-<userid>`
134
+ <img width="823" alt="bucket" src="docs/images/bucket.png">
135
+
136
+ * Create an API Gateway of type 'HTTP API' with name 'API Managed by Helix Deploy'
137
+ <img width="1132" alt="apigateway" src="docs/images/apigateway.png">
138
+
139
+ * Create a role for invoking the Lambda. Start by giving it the `AWSLambdaBasicExecutionRole`.
140
+ <img width="1293" alt="role" src="docs/images/role.png">
141
+
142
+ * Edit the role and add the Secrets Manager -> Read -> GetSecretValue permission.
143
+ <img width="1184" alt="perm" src="docs/images/perm.png">
144
+
145
+
146
+ Finally, to get access from the command line to your AWS account you need to configure the AWS environment.
147
+
148
+ ```
149
+ $ aws sts get-session-token
150
+ {
151
+ "Credentials": {
152
+ "AccessKeyId": "XXXYYY",
153
+ "SecretAccessKey": "abcdef",
154
+ "SessionToken": "... lots of chars ...",
155
+ "Expiration": "2023-10-03T17:28:34+00:00"
156
+ }
157
+ }
158
+ ```
159
+ Set the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` environment variables to the values from the above JSON result. Note that the session has a maximum timespan of 1 hour, so you need to refresh this regularly.
160
+
161
+
162
+ At this point you should be ready to deploy your function.
163
+
164
+ ```
165
+ $ npx hedy \
166
+ --build --verbose --directory ~/proj/hedy/temp \
167
+ --entryFile ~/proj/hedy/myproj/src/index.js --deploy \
168
+ --target aws --aws-region eu-west-1 \
169
+ --aws-role 'arn:aws:iam::148835428639:role/HedyInvocationRole' \
170
+ --aws-api 99q7f1czdf -l minor --name "myfunc@1"
171
+ ```
172
+
173
+ if all goes well, the the output will end with something like this:
174
+ ```
175
+ {
176
+ "aws": {
177
+ "name": "amazonwebservices;host=https://99q7f1czdf.execute-api.eu-west-1.amazonaws.com",
178
+ "url": "https://99q7f1czdf.execute-api.eu-west-1.amazonaws.com/default/myfunc/0.0.0"
179
+ }
180
+ }
181
+ ```
182
+
183
+ Now you can invoke your function as follows (note the URL is as reported by the `hedy` command with a slight change to the version number):
184
+ ```
185
+ $ curl https://99q7f1czdf.execute-api.eu-west-1.amazonaws.com/default/myfunc/v0.0
186
+ {"result": "it works!"}
187
+ ```
188
+
189
+
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [9.3.8](https://github.com/adobe/helix-deploy/compare/v9.3.7...v9.3.8) (2023-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **fastly:** Close fastly client after deploy ([#592](https://github.com/adobe/helix-deploy/issues/592)) ([81a593a](https://github.com/adobe/helix-deploy/commit/81a593a56dd11229e03aedc2320df37ba601a797)), closes [#587](https://github.com/adobe/helix-deploy/issues/587)
7
+
8
+ ## [9.3.7](https://github.com/adobe/helix-deploy/compare/v9.3.6...v9.3.7) (2023-10-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([c5f6f5b](https://github.com/adobe/helix-deploy/commit/c5f6f5b33a52c12839c1ac96cff46fddf2d499d0))
14
+
1
15
  ## [9.3.6](https://github.com/adobe/helix-deploy/compare/v9.3.5...v9.3.6) (2023-09-30)
2
16
 
3
17
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "9.3.6",
3
+ "version": "9.3.8",
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",
@@ -38,21 +38,21 @@
38
38
  "dependencies": {
39
39
  "@adobe/fastly-native-promises": "3.0.5",
40
40
  "@adobe/fetch": "4.1.0",
41
- "@aws-sdk/client-apigatewayv2": "3.421.0",
42
- "@aws-sdk/client-lambda": "3.421.0",
43
- "@aws-sdk/client-s3": "3.421.0",
44
- "@aws-sdk/client-secrets-manager": "3.421.0",
45
- "@aws-sdk/client-ssm": "3.421.0",
46
- "@aws-sdk/client-sts": "3.421.0",
47
- "@fastly/js-compute": "3.6.1",
41
+ "@aws-sdk/client-apigatewayv2": "3.427.0",
42
+ "@aws-sdk/client-lambda": "3.427.0",
43
+ "@aws-sdk/client-s3": "3.427.0",
44
+ "@aws-sdk/client-secrets-manager": "3.427.0",
45
+ "@aws-sdk/client-ssm": "3.427.0",
46
+ "@aws-sdk/client-sts": "3.427.0",
47
+ "@fastly/js-compute": "3.6.2",
48
48
  "@google-cloud/functions": "3.0.1",
49
49
  "@google-cloud/secret-manager": "5.0.1",
50
- "@google-cloud/storage": "7.1.0",
51
- "@rollup/plugin-alias": "5.0.0",
52
- "@rollup/plugin-commonjs": "25.0.4",
53
- "@rollup/plugin-json": "6.0.0",
54
- "@rollup/plugin-node-resolve": "15.2.1",
55
- "@rollup/plugin-terser": "0.4.3",
50
+ "@google-cloud/storage": "7.2.0",
51
+ "@rollup/plugin-alias": "5.0.1",
52
+ "@rollup/plugin-commonjs": "25.0.5",
53
+ "@rollup/plugin-json": "6.0.1",
54
+ "@rollup/plugin-node-resolve": "15.2.2",
55
+ "@rollup/plugin-terser": "0.4.4",
56
56
  "archiver": "6.0.1",
57
57
  "chalk-template": "1.1.0",
58
58
  "constants-browserify": "1.0.0",
@@ -62,7 +62,7 @@
62
62
  "fs-extra": "11.1.1",
63
63
  "isomorphic-git": "1.24.5",
64
64
  "openwhisk": "3.21.7",
65
- "rollup": "3.29.4",
65
+ "rollup": "4.0.2",
66
66
  "semver": "7.5.4",
67
67
  "tar": "6.2.0",
68
68
  "webpack": "5.88.2",
@@ -75,7 +75,7 @@
75
75
  "@semantic-release/changelog": "6.0.3",
76
76
  "@semantic-release/git": "10.0.1",
77
77
  "c8": "8.0.1",
78
- "eslint": "8.50.0",
78
+ "eslint": "8.51.0",
79
79
  "husky": "8.0.3",
80
80
  "lint-staged": "14.0.1",
81
81
  "mocha": "10.2.0",
@@ -153,6 +153,8 @@ service_id = ""
153
153
  this.log.debug(`--: updating gateway backend: ${host}`);
154
154
  await this._fastly.writeBackend(version, 'gateway', backend);
155
155
  }, true);
156
+
157
+ await this._fastly.discard();
156
158
  }
157
159
 
158
160
  async updatePackage() {
@@ -172,7 +174,7 @@ service_id = ""
172
174
  await this._fastly.updateDictItem(undefined, 'secrets', '_token', this.cfg.packageToken);
173
175
  await this._fastly.updateDictItem(undefined, 'secrets', '_package', `https://${this._cfg.fastlyGateway}/${this.cfg.packageName}/`);
174
176
 
175
- this._fastly.discard();
177
+ await this._fastly.discard();
176
178
  }
177
179
 
178
180
  get fullFunctionName() {