Skip to content

Fix local development with Pub/Sub emulator #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ In the shell that is running the Functions Framework, you'll see the message log
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.

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

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

Expand All @@ -109,7 +109,7 @@ async function main() {
await topic.create();
}
const createSubscriptionResponse = await topic.createSubscription('my_subscription', {
pushEndpoint: 'http://localhost:8080',
pushEndpoint: 'http://localhost:8080/projects/myproject/topics/my-topic',
});
}

Expand Down
Loading