HomeiOS Developmentios - ERROR 20:56.724 AWSPinpointProvider - updateEndpoint failed

ios – ERROR [ERROR] 20:56.724 AWSPinpointProvider – updateEndpoint failed [TypeError: Cannot read property ‘byteLength’ of undefined]


I’m new to Amplify, however have efficiently created this arrange through the CLI for ReactNative:

│ Class      │ Useful resource identify  │ Operation │ Supplier plugin   │

│ Auth          │ userPoolGroups │ No Change │ awscloudformation │

│ Auth          │ Lease           │ No Change │ awscloudformation │

│ Analytics     │ RentAppIOS     │ No Change │ awscloudformation │

│ Notifications │ RentAppIOS     │ No Change │                   │

Proper now I’m making an attempt to get push notifications to work for IOS utilizing PinPoint. All of the permissions look to be OK however I’m working into the an error when making an attempt to run updateEndpoint on Analytics which is meant to create a brand new endpoint in PinPoint. That is the error:

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

That is the operate which is named after person has logged in and is inflicting the error:

const registerForPushNotifications = async () => {
    const { attributes: {sub} } = await Auth.currentUserInfo();
    if (sub) {
      DeviceInfo.getDeviceToken().then((deviceToken) => {
          Analytics.updateEndpoint({
              handle: 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 anticipated. Right here is the config setup when the app is initiated:

Amplify.configure({
  ...awsconfig,
  Analytics: {
    disabled: false,
  },
  Predictions: {
    supplier: AmazonAIPredictionsProvider,
    area: awsconfig.aws_mobile_analytics_app_region,
  },
});

Analytics.configure({
  ...awsconfig,
  AWSPinpoint: {
    area: awsconfig.aws_mobile_analytics_app_region,
  },
});
PushNotification.configure({
  ...awsconfig,
  onNotification: operate (notification) {
    console.log('NOTIFICATION:', notification);
    Alert.alert(
      notification.title,
      notification.physique,
      [{ text: 'OK' }],
      { cancelable: false }
    );
    notification.end("backgroundFetchResultNewData");
  },
  permissions: {
    alert: true,
    badge: true,
    sound: true,
  },
  popInitialNotification: true,
  requestPermissions: true,
});

Right here is the aws-exports.js file instance 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: "Lease", 
    aws_mobile_analytics_auto_session_record: true,
    aws_mobile_analytics_disabled: false
};

export default awsmobile;

I actually hope somebody can see what’s mistaken, I’ve spent days trying over this and obtainable documentation on-line shouldn’t be highlighting something. I admire any suggestions 🙂

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments