Skip to content

Commit 2a214c8

Browse files
kenahrensAce Nassri
authored andcommitted
Proper setup for local testing of hello world (#772)
* Proper setup for local testing of hello world * Update README.md
1 parent 5ba1c27 commit 2a214c8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

functions/helloworld/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,21 @@ See the [Cloud Functions Hello World tutorial][tutorial].
1818

1919
1. Read and follow the [prerequisites](../../../../#prerequisites).
2020

21+
1. Install and run the [Google Cloud Functions Emulator](https://github.com/GoogleCloudPlatform/cloud-functions-emulator)
22+
23+
npm install -g @google-cloud/functions-emulator
24+
functions start
25+
2126
1. Install dependencies:
2227

2328
npm install
2429

30+
1. Set the following environment variables:
31+
32+
export GCF_REGION=us-central1
33+
export FUNCTIONS_TOPIC=[YOUR_PUBSUB_TOPIC]
34+
export FUNCTIONS_BUCKET=[YOUR_CLOUD_STORAGE_BUCKET]
35+
2536
1. Run the tests:
2637

2738
npm test

functions/helloworld/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"safe-buffer": "5.1.1"
2626
},
2727
"devDependencies": {
28-
"@google-cloud/functions-emulator": "^1.0.0-beta.5",
2928
"@google-cloud/nodejs-repo-tools": "^2.2.5",
3029
"@google-cloud/pubsub": "^0.17.0",
3130
"@google-cloud/storage": "^1.5.0",
@@ -43,9 +42,10 @@
4342
"requiresProjectId": true,
4443
"requiredEnvVars": [
4544
"BASE_URL",
45+
"GCLOUD_PROJECT",
4646
"GCF_REGION",
47-
"TOPIC",
48-
"BUCKET",
47+
"FUNCTIONS_TOPIC",
48+
"FUNCTIONS_BUCKET",
4949
"FUNCTIONS_CMD"
5050
]
5151
}

0 commit comments

Comments
 (0)