Error: exec is not supported in Mongo DB Atals Realm function

when i try to execute the following function I get: Error exec is not supported

exports = function(changeEvent) {
    const topicName = 'topicname';
    const data = JSON.stringify({foo: 'bar'});
    //const {PubSub} = require('pubsub');
    const {PubSub} = require('@google-cloud/pubsub')
    // Creates a client; cache this for further use
   const pubSubClient = new PubSub();
   async function publishMessageWithCustomAttributes() {
  // Publishes the message as a string, e.g. "Hello, world!" or JSON.stringify(someObject)
  const dataBuffer = Buffer.from(data);

  // Add two custom attributes, origin and username, to the message
  const customAttributes = {
    origin: 'nodejs-sample',
    username: 'gcp',

  const messageId = await pubSubClient
    .publish(dataBuffer, customAttributes);
  console.log(`Message ${messageId} published.`);


1 Like