Using Pusher Beams Node.js Server SDK in cloud code

Hi guys, I know very little about programming, I follow the instruction to use Pusher SDK in cloud code, but there was a problem. Can someone help me? :rofl: :rofl: :rofl: here is my code:

$ yarn add @pusher/push-notifications-server

const PushNotifications = require('@pusher/push-notifications-server'); 
 
let pushNotifications = new PushNotifications({
  instanceId: 'aaaaaaaaaaaaaaaaaaaaaaaaa',
  secretKey: 'aaaaaaaaaaaaaaaaaaaaaaaaa'
});                                                                    

module.exports = async function (event) {
  if (event.type === 'near') {
     pushNotifications.publishToInterests(['proximity'], {                                                          
    fcm: {
      notification: {
        title: 'proximity',
        body: 'near'
      }
  }                                                               
     }).then((publishResponse) => {
  console.log('Just published:', publishResponse.publishId);
     }).catch((error) => {
  console.log('Error:', error);
});  
 
  }
};

What is that problem? What are the symptoms? What is the error message?
Do you really have $ yarn add @pusher/push-notifications-server in your Cloud Code? Because it is not valid a Node.js code.

Yes, I have that strange sentence in Cloud Code, such an idiot :sweat_smile:
And there are two problems, one is this sentence cannot be resolved,
another is “missing semicolon before statement and missing name in function declaration” showed before module.exports…

Remove that line. It’s not a valid Node.js code. It’s a command used in operating system’s shell to install pusher module. Cloud Code works in sandboxed environment and all available modules are preinstalled so there is no need to install anything.