Skip to content

Commit 4d8eb24

Browse files
Fix local development with Pub/Sub emulator (#272)
* Fix local dev with PubSub emulator * address code review comments * review feedback: add return types, update emulator testing docs
1 parent 3a8c921 commit 4d8eb24

File tree

6 files changed

+5802
-21
lines changed

6 files changed

+5802
-21
lines changed

docs/events.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ In the shell that is running the Functions Framework, you'll see the message log
8686
Another way to test your cloud function Pub/Sub endpoint is to use the [Pub/Sub Emulator](https://cloud.google.com/pubsub/docs/emulator). This allows you to use the Pub/Sub notification from another service to trigger your cloud function.
8787

8888
The high level approach is to:
89-
1. Start the Pub/Sub Emulator
90-
2. Use the Pub/Sub client library to create a subscription and set the `pushEndpoint` to `http://localhost:8080`.
89+
1. [Start the Pub/Sub Emulator](https://cloud.google.com/pubsub/docs/emulator#start)
90+
2. Use the Pub/Sub client library to create a subscription and set the `pushEndpoint` to `http://localhost:8080/[TOPIC NAME]`.
9191

9292
After setup, all notifications to the subscription topic will be pushed to your cloud function.
9393

@@ -109,7 +109,7 @@ async function main() {
109109
await topic.create();
110110
}
111111
const createSubscriptionResponse = await topic.createSubscription('my_subscription', {
112-
pushEndpoint: 'http://localhost:8080',
112+
pushEndpoint: 'http://localhost:8080/projects/myproject/topics/my-topic',
113113
});
114114
}
115115

0 commit comments

Comments
 (0)