Skip to content

Instantly share code, notes, and snippets.

@elephantsneverforget
Created February 19, 2025 19:08
Show Gist options
  • Save elephantsneverforget/8a1a2de2f9a7f097bb9f654e62f2541e to your computer and use it in GitHub Desktop.
Save elephantsneverforget/8a1a2de2f9a7f097bb9f654e62f2541e 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