How to publish message from pipedream to pub/sub in google cloud

I am trying to publish a message from pipedream to pub/sub topic in google cloud platform. There is no such built in action available for google cloud. So I have used NodeJs code snippet for doing so , and the code is as follows

module.exports = defineComponent({
props: {
google_cloud: {
type: “app”,
app: “google_cloud”,
async run({steps, $}) {
const { Storage } = require(‘@google-cloud/storage’)
const key = JSON.parse(this.google_cloud.$auth.key_json)
const storage = new Storage({
projectId: key.project_id,
credentials: {
client_email: key.client_email,
private_key: key.private_key,
const {PubSub} = require(‘@google-cloud/pubsub’);
const pubSubClient = new PubSub();
async function publishMessage() {
const dataBuffer = Buffer.from(“hi”);
try {
const messageId = await pubSubClient
.publishMessage({data: dataBuffer});
console.log(Message ${messageId} published.);
} catch (error) {
console.error(Received error while publishing: ${error.message});
process.exitCode = 1;

When I tested it , it says success . But I could not able to find the published message in google cloud topic. Also there is no logs in the pipedream eventhough there is console.log for both try and catch block.