Skip to content

Send the headers and body of an HTTP request to a Pub/Sub topic with Google Cloud Functions.

License

Notifications You must be signed in to change notification settings

ppawiggers/http-to-pubsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-to-pubsub

Send the headers and body of an HTTP request to a Pub/Sub topic with Google Cloud Functions.

Deploying to Google Cloud Functions

gcloud beta functions deploy http-to-pubsub \
    --region=europe-west1 \
    --runtime=python37 \
    --entry-point=F \
    --trigger-http \
    --set-env-vars PUBSUB_TOPIC_PATH=[YOUR_PUBSUB_TOPIC_PATH]

It currently uses gcloud beta because setting environment variables via the CLI is not available in stable yet.

Make sure YOUR_PUBSUB_TOPIC_PATH exists.

Test

curl \
    --request POST \
    --header "Content-Type: application/json" \
    --header "X-MyHeader: 123" \
    --data '{"foo": "bar"}' \
    [YOUR_CLOUD_FUNCTION_TRIGGER_URL]

About

Send the headers and body of an HTTP request to a Pub/Sub topic with Google Cloud Functions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages