Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 17331

ERROR [ERROR] 20:56.724 AWSPinpointProvider - updateEndpoint failed [TypeError: Cannot read property 'byteLength' of undefined]

$
0
0

I am new to Amplify, but have successfully created this set up via the CLI for ReactNative:

│ Category      │ Resource name  │ Operation │ Provider plugin   ││ Auth          │ userPoolGroups │ No Change │ awscloudformation ││ Auth          │ Rent           │ No Change │ awscloudformation ││ Analytics     │ RentAppIOS     │ No Change │ awscloudformation ││ Notifications │ RentAppIOS     │ No Change ││

Right now I am trying to get push notifications to work for IOS using PinPoint. All the permissions look to be OK but I am running into the an error when trying to run updateEndpoint on Analytics which is supposed to create a new endpoint in PinPoint. This is the error:

AWSPinpointProvider - updateEndpoint failed [TypeError: Cannot read property 'byteLength' of undefined]

This is the function which is called after user has logged in and is causing the error:

const registerForPushNotifications = async () => {    const { attributes: {sub} } = await Auth.currentUserInfo();    if (sub) {      DeviceInfo.getDeviceToken().then((deviceToken) => {          Analytics.updateEndpoint({              address: deviceToken,              optOut: "NONE",              userId: sub,              channelType: "APNS",        }).then(() => {           console.log("Endpoint created");        }).catch((error) => {           console.log('Error updating endpoint', error);        });      });    }  }

The variables sub and deviceToken have values as expected. Here is the config setup when the app is initiated:

Amplify.configure({  ...awsconfig,  Analytics: {    disabled: false,  },  Predictions: {    provider: AmazonAIPredictionsProvider,    region: awsconfig.aws_mobile_analytics_app_region,  },});Analytics.configure({  ...awsconfig,  AWSPinpoint: {    region: awsconfig.aws_mobile_analytics_app_region,  },});PushNotification.configure({  ...awsconfig,  onNotification: function (notification) {    console.log('NOTIFICATION:', notification);    Alert.alert(      notification.title,      notification.body,      [{ text: 'OK' }],      { cancelable: false }    );    notification.finish("backgroundFetchResultNewData");  },  permissions: {    alert: true,    badge: true,    sound: true,  },  popInitialNotification: true,  requestPermissions: true,});

Here is the aws-exports.js file example which is being imported as awsconfig:

const awsmobile = {    aws_project_region: "eu-west-2",    aws_cognito_identity_pool_id: "eu-west-2:xxxxxxxx-c514-4431-91c0-xxxxxxxx",    aws_cognito_region: "eu-west-2",    aws_user_pools_id: "eu-west-2_xxxxxxxx",    aws_user_pools_web_client_id: "xxxxxxxxxxxxxxxxxxx2m5pmf",    aws_pinpoint_id: "b6846xxxxxxxxxxxxxxxxxxxxxxxxxxx",    aws_mobile_analytics_app_id: "xxxxxxxxxxete",    aws_mobile_analytics_app_region: "eu-west-2",     aws_mobile_analytics_app_title: "Rent",     aws_mobile_analytics_auto_session_record: true,    aws_mobile_analytics_disabled: false};export default awsmobile;

I really hope someone can see what is wrong, I've spent days looking over this and available documentation online is not highlighting anything. I appreciate any feedback :)


Viewing all articles
Browse latest Browse all 17331

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>