Tying to implement Pusher Beam in react native but received the error below.
error: bundling failed: Error: Unable to resolve module
crypto
fromPROJECT-DIRECTORY\node_modules\@pusher\push-notifications-server\utils.js
: Modulecrypto
does not exist in the Haste module map
Refer to this doc for the steps https://pusher.com/tutorials/push-notifications-android
In my App.js I put exactly the same code for the notification testing code
const PushNotifications = require('@pusher/push-notifications-server');
let pushNotifications = new PushNotifications({
instanceId: 'YOUR_INSTANCE_ID_HERE',
secretKey: 'YOUR_SECRET_KEY_HERE',
});
pushNotifications
.publishToInterests(['hello'], {
fcm: {
notification: {
title: 'Hello World',
body: 'Hello!',
},
},
})
.then(publishResponse => {
console.log('Just published:', publishResponse.publishId);
})
.catch(error => {
console.log('Error:', error);
});