Skip to content

Commit a80574c

Browse files
fix: update nodejs and cloud functions (#612)
1 parent 90f5b72 commit a80574c

File tree

12 files changed

+34
-34
lines changed

12 files changed

+34
-34
lines changed

.kokoro/functions-helloworld.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ gcloud config set project $GCLOUD_PROJECT
3434
function cleanup {
3535
CODE=$?
3636

37-
gcloud beta functions delete helloHttp -q
38-
gcloud beta functions delete helloGET -q
39-
gcloud beta functions delete helloBackground -q
40-
gcloud beta functions delete helloPubSub -q
41-
gcloud beta functions delete helloGCS -q
42-
gcloud beta functions delete helloError -q
43-
gcloud beta functions delete helloError2 -q
44-
gcloud beta functions delete helloError3 -q
45-
gcloud beta functions delete helloTemplate -q
37+
gcloud functions delete helloHttp -q
38+
gcloud functions delete helloGET -q
39+
gcloud functions delete helloBackground -q
40+
gcloud functions delete helloPubSub -q
41+
gcloud functions delete helloGCS -q
42+
gcloud functions delete helloError -q
43+
gcloud functions delete helloError2 -q
44+
gcloud functions delete helloError3 -q
45+
gcloud functions delete helloTemplate -q
4646
}
4747
trap cleanup EXIT
4848

circle.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
machine:
2020
node:
21-
version: 6.14.1
21+
version: 8.11.1
2222

2323
# Use for broader build-related configuration
2424
general:
@@ -31,7 +31,7 @@ dependencies:
3131
override:
3232
- echo $KEYFILE > /home/ubuntu/nodejs-docs-samples/key.json
3333
- gcloud auth activate-service-account --key-file /home/ubuntu/nodejs-docs-samples/key.json || true
34-
- yarn global add ava nyc codecov semistandard @google-cloud/[email protected] @google-cloud/[email protected]alpha.29
34+
- yarn global add ava nyc codecov semistandard @google-cloud/[email protected] @google-cloud/[email protected]beta.4
3535
- yarn install
3636
- yarn run lint
3737
- samples test install -l=functions/background

functions/datastore/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ Functions for your project.
2525

2626
1. Deploy the "get" function with an HTTP trigger:
2727

28-
gcloud beta functions deploy get --trigger-http
28+
gcloud functions deploy get --trigger-http
2929

3030
1. Deploy the "set" function with an HTTP trigger:
3131

32-
gcloud beta functions deploy set --trigger-http
32+
gcloud functions deploy set --trigger-http
3333

3434
1. Deploy the "del" function with an HTTP trigger:
3535

36-
gcloud beta functions deploy del --trigger-http
36+
gcloud functions deploy del --trigger-http
3737

3838
1. Call the "set" function to create a new entity:
3939

40-
gcloud beta functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description":"Buy milk"}}'
40+
gcloud functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description":"Buy milk"}}'
4141

4242
or
4343

@@ -48,7 +48,7 @@ Functions for your project.
4848

4949
1. Call the "get" function to read the newly created entity:
5050

51-
gcloud beta functions call get --data '{"kind":"Task","key":"sampletask1"}'
51+
gcloud functions call get --data '{"kind":"Task","key":"sampletask1"}'
5252

5353
or
5454

@@ -70,7 +70,7 @@ Functions for your project.
7070

7171
1. Call the "get" function again to verify it was deleted:
7272

73-
gcloud beta functions call get --data '{"kind":"Task","key":"sampletask1"}'
73+
gcloud functions call get --data '{"kind":"Task","key":"sampletask1"}'
7474

7575
or
7676

functions/datastore/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function getKeyFromRequestData (requestData) {
4444
* Creates and/or updates a record.
4545
*
4646
* @example
47-
* gcloud beta functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description": "Buy milk"}}'
47+
* gcloud functions call set --data '{"kind":"Task","key":"sampletask1","value":{"description": "Buy milk"}}'
4848
*
4949
* @param {object} req Cloud Function request context.
5050
* @param {object} req.body The request body.
@@ -78,7 +78,7 @@ exports.set = (req, res) => {
7878
* Retrieves a record.
7979
*
8080
* @example
81-
* gcloud beta functions call get --data '{"kind":"Task","key":"sampletask1"}'
81+
* gcloud functions call get --data '{"kind":"Task","key":"sampletask1"}'
8282
*
8383
* @param {object} req Cloud Function request context.
8484
* @param {object} req.body The request body.
@@ -110,7 +110,7 @@ exports.get = (req, res) => {
110110
* Deletes a record.
111111
*
112112
* @example
113-
* gcloud beta functions call del --data '{"kind":"Task","key":"sampletask1"}'
113+
* gcloud functions call del --data '{"kind":"Task","key":"sampletask1"}'
114114
*
115115
* @param {object} req Cloud Function request context.
116116
* @param {object} req.body The request body.

functions/datastore/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"lint": "repo-tools lint",
1616
"pretest": "npm run lint",
17-
"e2e-test": "export FUNCTIONS_CMD='gcloud beta functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js",
17+
"e2e-test": "export FUNCTIONS_CMD='gcloud functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js",
1818
"system-test": "export FUNCTIONS_CMD='functions' && sh test/updateFunctions.sh && BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" ava -T 20s --verbose test/*.test.js",
1919
"test": "npm run system-test"
2020
},
@@ -23,7 +23,7 @@
2323
"supertest": "^3.0.0"
2424
},
2525
"devDependencies": {
26-
"@google-cloud/functions-emulator": "^1.0.0-alpha.29",
26+
"@google-cloud/functions-emulator": "^1.0.0-beta.4",
2727
"@google-cloud/nodejs-repo-tools": "2.2.1",
2828
"ava": "0.25.0",
2929
"proxyquire": "2.0.0",

functions/gcs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ Functions for your project.
3232

3333
1. Deploy the "wordCount" function with an HTTP trigger:
3434

35-
gcloud beta functions deploy wordCount --trigger-http
35+
gcloud functions deploy wordCount --trigger-http
3636

3737
1. Call the "wordCount" function using the sample file:
3838

39-
gcloud beta functions call wordCount --data '{"bucket":"YOUR_BUCKET_NAME","file":"sample.txt"}'
39+
gcloud functions call wordCount --data '{"bucket":"YOUR_BUCKET_NAME","file":"sample.txt"}'
4040

4141
* Replace `YOUR_BUCKET_NAME` with the name of your Cloud Storage Bucket.
4242

functions/helloworld/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"lint": "repo-tools lint",
1616
"pretest": "npm run lint",
17-
"e2e-test": "export FUNCTIONS_CMD='gcloud beta functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js",
17+
"e2e-test": "export FUNCTIONS_CMD='gcloud functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js",
1818
"test": "export FUNCTIONS_CMD='functions-emulator' && sh test/updateFunctions.sh && export BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" && ava -T 20s --verbose -c 1 test/index.test.js test/*unit*test.js test/*integration*test.js",
1919
"system-test": "export FUNCTIONS_CMD='functions-emulator' && sh test/updateFunctions.sh && export BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" && ava -T 20s --verbose test/*.test.js"
2020
},

functions/helloworld/test/sample.system.pubsub.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Pubsub = require(`@google-cloud/pubsub`);
2121
const pubsub = Pubsub();
2222

2323
const topicName = process.env.FUNCTIONS_TOPIC;
24-
const baseCmd = `gcloud beta functions`;
24+
const baseCmd = `gcloud functions`;
2525

2626
test(`helloPubSub: should print a name`, async (t) => {
2727
t.plan(1);

functions/helloworld/test/sample.system.storage.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const gcsFileName = `test-${uuid.v4()}.txt`;
2727

2828
const bucketName = process.env.BUCKET_NAME;
2929
const bucket = storage.bucket(bucketName);
30-
const baseCmd = `gcloud beta functions`;
30+
const baseCmd = `gcloud functions`;
3131

3232
test.serial(`helloGCS: should print uploaded message`, async (t) => {
3333
t.plan(1);

functions/imagemagick/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Functions for your project.
2727

2828
1. Deploy the `blurOffensiveImages` function with a Storage trigger:
2929

30-
gcloud beta functions deploy blurOffensiveImages --trigger-bucket=YOUR_BUCKET_NAME
30+
gcloud functions deploy blurOffensiveImages --trigger-bucket=YOUR_BUCKET_NAME
3131

3232
* Replace `YOUR_BUCKET_NAME` with the name of the Cloud Storage Bucket you created earlier.
3333

@@ -36,7 +36,7 @@ Functions for your project.
3636

3737
1. Check the logs for the `blurOffensiveImages` function:
3838

39-
gcloud beta functions get-logs blurOffensiveImages
39+
gcloud functions get-logs blurOffensiveImages
4040

4141
You should see something like this in your console:
4242

functions/pubsub/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ can skip this step):
2828

2929
1. Deploy the `publish` function with an HTTP trigger:
3030

31-
gcloud beta functions deploy publish --trigger-http
31+
gcloud functions deploy publish --trigger-http
3232

3333
1. Deploy the `subscribe` function with the Pub/Sub topic as a trigger:
3434

35-
gcloud beta functions deploy subscribe --trigger-topic YOUR_TOPIC_NAME
35+
gcloud functions deploy subscribe --trigger-topic YOUR_TOPIC_NAME
3636

3737
* Replace `YOUR_TOPIC_NAME` with the name of your Pub/Sub Topic.
3838

3939
1. Call the `publish` function:
4040

41-
gcloud beta functions call publish --data '{"topic":"YOUR_TOPIC_NAME","message":"Hello World!"}'
41+
gcloud functions call publish --data '{"topic":"YOUR_TOPIC_NAME","message":"Hello World!"}'
4242

4343
* Replace `YOUR_TOPIC_NAME` with the name of your Pub/Sub Topic.
4444

functions/uuid/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Functions for your project.
2222

2323
1. Deploy the `uuid` function with an HTTP trigger:
2424

25-
gcloud beta functions deploy uuid --trigger-http
25+
gcloud functions deploy uuid --trigger-http
2626

2727
1. Call the `uuid` function:
2828

29-
gcloud beta functions call uuid
29+
gcloud functions call uuid
3030

3131
You should see something like this in your console:
3232

0 commit comments

Comments
 (0)