Skip to content

Instantly share code, notes, and snippets.

@elephantsneverforget
Last active March 23, 2025 17:35
Show Gist options
  • Save elephantsneverforget/bb2b82afb4f1b8ef820d65b1fdcdd65d to your computer and use it in GitHub Desktop.
Save elephantsneverforget/bb2b82afb4f1b8ef820d65b1fdcdd65d to your computer and use it in GitHub Desktop.
const functions = require('@google-cloud/functions-framework');
functions.cloudEvent('helloPubSub', cloudEvent => {
// The Pub/Sub message from Elevar is passed as the CloudEvent's data payload.
const base64Data = cloudEvent.data.message.data;
// Decode the base 64 encoded message
const data = Buffer.from(base64Data, 'base64').toString();
// Log the results
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment