aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.4k stars 2.11k forks source link

Error NoCredentials and Unable to Register Devices for Push Notifications #13240

Closed SwhiteMHC closed 3 months ago

SwhiteMHC commented 3 months ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication, Analytics, Push Notifications

Amplify Version

v6

Amplify Categories

auth, analytics, notifications

Backend

Amplify CLI

Environment information

``` # Put output below this line System: OS: macOS 14.2.1 CPU: (10) arm64 Apple M2 Pro Memory: 613.06 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.11.1 - /usr/local/bin/node Yarn: 1.22.22 - /usr/local/bin/yarn npm: 10.2.4 - /usr/local/bin/npm pnpm: 8.15.5 - /usr/local/bin/pnpm Browsers: Chrome: 123.0.6312.107 Safari: 17.2.1 npmPackages: @apollo/client: 3.8.6 => 3.8.6 (3.9.11) @apollo/client/cache: undefined () @apollo/client/core: undefined () @apollo/client/dev: undefined () @apollo/client/errors: undefined () @apollo/client/link/batch: undefined () @apollo/client/link/batch-http: undefined () @apollo/client/link/context: undefined () @apollo/client/link/core: undefined () @apollo/client/link/error: undefined () @apollo/client/link/http: undefined () @apollo/client/link/persisted-queries: undefined () @apollo/client/link/remove-typename: undefined () @apollo/client/link/retry: undefined () @apollo/client/link/schema: undefined () @apollo/client/link/subscriptions: undefined () @apollo/client/link/utils: undefined () @apollo/client/link/ws: undefined () @apollo/client/react: undefined () @apollo/client/react/components: undefined () @apollo/client/react/context: undefined () @apollo/client/react/hoc: undefined () @apollo/client/react/hooks: undefined () @apollo/client/react/internal: undefined () @apollo/client/react/parser: undefined () @apollo/client/react/ssr: undefined () @apollo/client/testing: undefined () @apollo/client/testing/core: undefined () @apollo/client/utilities: undefined () @apollo/client/utilities/globals: undefined () @apollo/client/utilities/subscriptions/relay: undefined () @apollo/client/utilities/subscriptions/urql: undefined () @aws-amplify/react-native: ^1.0.28 => 1.0.28 @aws-amplify/rtn-push-notification: 1.2.5 => 1.2.5 @aws-amplify/ui-react-native: 2.0.3 => 2.0.3 @babel/core: ^7.20.0 => 7.24.4 @babel/preset-env: ^7.20.0 => 7.24.4 @babel/runtime: 7.20.0 => 7.20.0 (7.24.4) @expo/metro-config: ^0.10.7 => 0.10.7 @expo/ngrok: 4.1.0 => 4.1.0 @faker-js/faker: ^8.4.1 => 8.4.1 @jest/globals: 29.7.0 => 29.7.0 @managedhealth/bac-rn-module: ^1.0.1 => 1.0.1 @react-native-async-storage/async-storage: 1.18.2 => 1.18.2 @react-native-community/netinfo: 9.3.10 => 9.3.10 @react-native-community/slider: 4.4.2 => 4.4.2 @react-native-picker/picker: 2.4.10 => 2.4.10 @react-native/eslint-config: 0.72.2 => 0.72.2 @react-native/metro-config: 0.72.11 => 0.72.11 @react-navigation/native: 6.1.7 => 6.1.7 @react-navigation/native-stack: 6.9.13 => 6.9.13 @testing-library/react: 14.0.0 => 14.0.0 @testing-library/react-hooks: 8.0.1 => 8.0.1 @tsconfig/react-native: 3.0.0 => 3.0.0 @types/apollo-upload-client: 17.0.4 => 17.0.4 @types/jest: 29.5.5 => 29.5.5 @types/node: ^20.11.19 => 20.12.7 @types/react: ^18.2.48 => 18.2.75 @types/react-native-calendar-picker: 7.0.4 => 7.0.4 @types/react-native-vector-icons: 6.4.15 => 6.4.15 @types/react-test-renderer: 18.0.0 => 18.0.0 HelloWorld: 0.0.1 apollo-upload-client: 17.0.0 => 17.0.0 aws-amplify: 6.0.28 => 6.0.28 aws-amplify/adapter-core: undefined () aws-amplify/analytics: undefined () aws-amplify/analytics/kinesis: undefined () aws-amplify/analytics/kinesis-firehose: undefined () aws-amplify/analytics/personalize: undefined () aws-amplify/analytics/pinpoint: undefined () aws-amplify/api: undefined () aws-amplify/api/server: undefined () aws-amplify/auth: undefined () aws-amplify/auth/cognito: undefined () aws-amplify/auth/cognito/server: undefined () aws-amplify/auth/enable-oauth-listener: undefined () aws-amplify/auth/server: undefined () aws-amplify/data: undefined () aws-amplify/data/server: undefined () aws-amplify/datastore: undefined () aws-amplify/in-app-messaging: undefined () aws-amplify/in-app-messaging/pinpoint: undefined () aws-amplify/push-notifications: undefined () aws-amplify/push-notifications/pinpoint: undefined () aws-amplify/storage: undefined () aws-amplify/storage/s3: undefined () aws-amplify/storage/s3/server: undefined () aws-amplify/storage/server: undefined () aws-amplify/utils: undefined () babel-jest: 29.2.1 => 29.2.1 browserstack-node-sdk: ^1.32.0 => 1.32.6 clsx: 2.0.0 => 2.0.0 dotenv: ^16.4.5 => 16.4.5 (16.0.3) eslint: 8.19.0 => 8.19.0 expo: ~49.0.15 => 49.0.23 expo-constants: 14.4.2 => 14.4.2 expo-dev-client: ~2.4.13 => 2.4.13 expo-file-system: ~15.4.5 => 15.4.5 expo-image-manipulator: ~11.3.0 => 11.3.0 expo-local-authentication: ~13.4.1 => 13.4.1 expo-splash-screen: ~0.20.5 => 0.20.5 expo-status-bar: ~1.6.0 => 1.6.0 graphql: 16.8.1 => 16.8.1 (15.8.0) haversine: 1.1.1 => 1.1.1 metro-react-native-babel-preset: 0.76.8 => 0.76.8 mobx: 6.10.2 => 6.10.2 mobx-react-lite: 4.0.4 => 4.0.4 mocha: ^10.3.0 => 10.4.0 moment: 2.29.4 => 2.29.4 (2.30.1) nativewind: 2.0.11 => 2.0.11 prettier: 2.4.1 => 2.4.1 react: 18.2.0 => 18.2.0 react-hook-form: 7.47.0 => 7.47.0 (7.51.2) react-native: 0.72.10 => 0.72.10 (0.73.6) react-native-blob-util: ^0.19.6 => 0.19.8 react-native-calendar-picker: 7.1.4 => 7.1.4 react-native-device-info: ^10.12.0 => 10.13.1 react-native-dotenv: 3.4.9 => 3.4.9 react-native-encrypted-storage: 4.0.3 => 4.0.3 react-native-geocoding: 0.5.0 => 0.5.0 react-native-geolocation-service: 5.3.1 => 5.3.1 react-native-get-random-values: ~1.9.0 => 1.9.0 react-native-keychain: 8.1.2 => 8.1.2 react-native-maps: 1.7.1 => 1.7.1 react-native-pdf: ^6.7.4 => 6.7.4 react-native-permissions: ^4.0.1 => 4.1.5 react-native-safe-area-context: 4.6.3 => 4.6.3 react-native-screens: ~3.22.0 => 3.22.1 react-native-url-polyfill: 2.0.0 => 2.0.0 react-native-uuid: 2.0.1 => 2.0.1 react-native-vector-icons: 10.0.0 => 10.0.0 react-native-vision-camera: 3.1.0 => 3.1.0 react-test-renderer: 18.2.0 => 18.2.0 selenium-webdriver: 4.10.0 => 4.10.0 tailwindcss: 3.3.2 => 3.3.2 ts-node: ^10.9.2 => 10.9.2 typescript: 4.8.4 => 4.8.4 util: 0.12.5 => 0.12.5 webdriverio: ^8.33.1 => 8.35.1 npmGlobalPackages: appium: 2.4.1 corepack: 0.23.0 eas-cli: 7.6.0 expo: 50.0.13 npm: 10.2.4 pnpm: 8.15.5 typescript: 5.4.4 yarn: 1.22.22 ```

Describe the bug

Devices fail to register their token with Amazon Pinpoint.

Expected behavior

Devices successfully register with Amazon Pinpoint, allowing for push notifications to be sent to the device.

Reproduction steps

N/A

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-west-2",
    "aws_mobile_analytics_app_id": "XXXX",
    "aws_mobile_analytics_app_region": "us-west-2",
    "Analytics": {
        "AWSPinpoint": {
            "appId": "XXXX",
            "region": "us-west-2"
        }
    },
    "Notifications": {
        "Push": {
            "AWSPinpoint": {
                "appId": "XXXX",
                "region": "us-west-2"
            }
        }
    },
    "aws_cognito_identity_pool_id": "XXXX",
    "aws_cognito_region": "us-west-2",
    "aws_user_pools_id": "XXXX",
    "aws_user_pools_web_client_id": "XXXX",
    "oauth": {},
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "EMAIL"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": []
};

export default awsmobile;

Manual configuration

Amplify.configure({
  Auth: {
    Cognito: {
      //  Amazon Cognito User Pool ID
      userPoolId: 'XXXX',
      // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
      userPoolClientId: 'XXXX',
      // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
      identityPoolId: 'XXXX',
    },
  },
  Notifications: {
    PushNotification: {
      Pinpoint: {
        appId: 'XXXX',
        region: 'us-west-2',
      },
    },
  },
  Analytics: {
    Pinpoint: {
      appId: 'XXXX',
      region: 'us-west-2',
    },
  },
});

Additional configuration

{
    "UserPool": {
        "Id": "XXXX",
        "Name": "XXXX",
        "Policies": {
            "PasswordPolicy": {
                "MinimumLength": 8,
                "RequireUppercase": false,
                "RequireLowercase": false,
                "RequireNumbers": false,
                "RequireSymbols": false,
                "TemporaryPasswordValidityDays": 7
            }
        },
        "DeletionProtection": "ACTIVE",
        "LambdaConfig": {},
        "LastModifiedDate": "2024-04-10T14:18:04.298000-07:00",
        "CreationDate": "2024-02-07T11:03:37.436000-08:00",
        "SchemaAttributes": [
            {
                "Name": "profile",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "address",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "birthdate",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "10",
                    "MaxLength": "10"
                }
            },
            {
                "Name": "gender",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "preferred_username",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "updated_at",
                "AttributeDataType": "Number",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "NumberAttributeConstraints": {
                    "MinValue": "0"
                }
            },
            {
                "Name": "website",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "picture",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "identities",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {}
            },
            {
                "Name": "sub",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": false,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "1",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "zoneinfo",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "locale",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "given_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "family_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "middle_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "nickname",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            }
        ],
        "UsernameAttributes": [
            "email"
        ],
        "EmailVerificationMessage": "Your verification code is {####}",
        "EmailVerificationSubject": "Your verification code",
        "VerificationMessageTemplate": {
            "EmailMessage": "Your verification code is {####}",
            "EmailSubject": "Your verification code",
            "DefaultEmailOption": "CONFIRM_WITH_CODE"
        },
        "UserAttributeUpdateSettings": {
            "AttributesRequireVerificationBeforeUpdate": []
        },
        "MfaConfiguration": "OFF",
        "EstimatedNumberOfUsers": 4,
        "EmailConfiguration": {
            "EmailSendingAccount": "COGNITO_DEFAULT"
        },
        "UserPoolTags": {},
        "AdminCreateUserConfig": {
            "AllowAdminCreateUserOnly": false,
            "UnusedAccountValidityDays": 7
        },
        "UsernameConfiguration": {
            "CaseSensitive": false
        },
        "Arn": "XXXX",
        "AccountRecoverySetting": {
            "RecoveryMechanisms": [
                {
                    "Priority": 1,
                    "Name": "verified_email"
                },
                {
                    "Priority": 2,
                    "Name": "verified_phone_number"
                }
            ]
        }
    }
}

Mobile Device

iPhone SE 2020

Mobile Operating System

iOS 17.2

Mobile Browser

N/A

Mobile Browser Version

N/A

Additional information and screenshots

{
  "name": "com.mhc.appropos",
  "version": "1.9.1",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --verbose && yarn ts-node scripts/regression-ms.ts",
    "eas-build-pre-install": "echo $AWS_EXPORTS | base64 --decode > ./src/aws-exports.js && echo $AMPLIFY_CONFIG | base64 --decode > ./src/amplifyconfiguration.json",
    "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
    "build:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && yarn clean:drawable",
    "clean:drawable": "rm -rf ./android/app/src/main/res/drawable-* && rm -rf ./android/app/src/main/res/raw",
    "postinstall": "yarn run build:ios && yarn run build:android",
    "browser:ios": "cd browserstack/ios && browserstack-node-sdk node test.js --env-file ../../.env",
    "browser:android": "cd browserstack/android && browserstack-node-sdk node test.js --env-file ../../.env"
  },
  "dependencies": {
    "@apollo/client": "3.8.6",
    "@aws-amplify/react-native": "^1.0.28",
    "@aws-amplify/rtn-push-notification": "1.2.5",
    "@aws-amplify/ui-react-native": "2.0.3",
    "@expo/metro-config": "^0.10.7",
    "@expo/ngrok": "4.1.0",
    "@jest/globals": "29.7.0",
    "@managedhealth/bac-rn-module": "^1.0.1",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-community/netinfo": "9.3.10",
    "@react-native-community/slider": "4.4.2",
    "@react-native-picker/picker": "2.4.10",
    "@react-navigation/native": "6.1.7",
    "@react-navigation/native-stack": "6.9.13",
    "@testing-library/react": "14.0.0",
    "@testing-library/react-hooks": "8.0.1",
    "@types/jest": "29.5.5",
    "@types/node": "^20.11.19",
    "@types/react-native-calendar-picker": "7.0.4",
    "@types/react-native-vector-icons": "6.4.15",
    "apollo-upload-client": "17.0.0",
    "aws-amplify": "6.0.28",
    "browserstack-node-sdk": "^1.32.0",
    "clsx": "2.0.0",
    "dotenv": "^16.4.5",
    "expo": "~49.0.15",
    "expo-constants": "14.4.2",
    "expo-dev-client": "~2.4.13",
    "expo-file-system": "~15.4.5",
    "expo-image-manipulator": "~11.3.0",
    "expo-local-authentication": "~13.4.1",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "graphql": "16.8.1",
    "haversine": "1.1.1",
    "mobx": "6.10.2",
    "mobx-react-lite": "4.0.4",
    "mocha": "^10.3.0",
    "moment": "2.29.4",
    "nativewind": "2.0.11",
    "react": "18.2.0",
    "react-hook-form": "7.47.0",
    "react-native": "0.72.10",
    "react-native-blob-util": "^0.19.6",
    "react-native-calendar-picker": "7.1.4",
    "react-native-device-info": "^10.12.0",
    "react-native-dotenv": "3.4.9",
    "react-native-encrypted-storage": "4.0.3",
    "react-native-geocoding": "0.5.0",
    "react-native-geolocation-service": "5.3.1",
    "react-native-get-random-values": "~1.9.0",
    "react-native-keychain": "8.1.2",
    "react-native-maps": "1.7.1",
    "react-native-pdf": "^6.7.4",
    "react-native-permissions": "^4.0.1",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-url-polyfill": "2.0.0",
    "react-native-uuid": "2.0.1",
    "react-native-vector-icons": "10.0.0",
    "react-native-vision-camera": "3.1.0",
    "selenium-webdriver": "4.10.0",
    "util": "0.12.5",
    "webdriverio": "^8.33.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "7.20.0",
    "@faker-js/faker": "^8.4.1",
    "@react-native/eslint-config": "0.72.2",
    "@react-native/metro-config": "0.72.11",
    "@tsconfig/react-native": "3.0.0",
    "@types/apollo-upload-client": "17.0.4",
    "@types/react": "^18.2.48",
    "@types/react-test-renderer": "18.0.0",
    "babel-jest": "29.2.1",
    "eslint": "8.19.0",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "2.4.1",
    "react-test-renderer": "18.2.0",
    "tailwindcss": "3.3.2",
    "ts-node": "^10.9.2",
    "typescript": "4.8.4"
  },
  "private": true,
  "resolutions": {
    "wrap-ansi": "7.0.0",
    "string-width": "4.1.0"
  }
}

IMG_0013 IMG_0012

SwhiteMHC commented 3 months ago

Possible source of issue:

It seems initializePushNotifications() is ultimately calling await fetchAuthSession() from @aws-amplify/core. This call is failing as no user's are currently logged in. I am using the Amplify UI Authenticator for React Native, which is loaded to log the user in AFTER initializePushNotifications() has already been called....

import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';

import { Amplify } from 'aws-amplify';
import { initializePushNotifications } from 'aws-amplify/push-notifications';
import amplifyconfig from './src/amplifyconfiguration.json';

Amplify.configure(amplifyconfig);
initializePushNotifications();

AppRegistry.registerComponent(appName, () => App);

My configuration is similar (App.js).

import React from 'react';

// AWS
import {Authenticator} from '@aws-amplify/ui-react-native';
import {Amplify} from 'aws-amplify';
import {initializePushNotifications} from 'aws-amplify/push-notifications';

// Components
import AuthenticationGateway from './src/components/AuthenticationGateway/AuthenticationGateway';

// SplashScreen
import * as SplashScreen from 'expo-splash-screen';

SplashScreen.preventAutoHideAsync();
setTimeout(SplashScreen.hideAsync, 5000);

Amplify.configure({
  Auth: {
    Cognito: {
      //  Amazon Cognito User Pool ID
      userPoolId: 'XXXX',
      // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
      userPoolClientId: 'XXXX',
      // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
      identityPoolId: 'XXXX',
    },
  },
  Notifications: {
    PushNotification: {
      Pinpoint: {
        appId: 'XXXX',
        region: 'us-west-2',
      },
    },
  },
  Analytics: {
    Pinpoint: {
      appId: 'XXXX',
      region: 'us-west-2',
    },
  },
});

initializePushNotifications();

function App() {
  return (
    <Authenticator.Provider>
      <AuthenticationGateway />
    </Authenticator.Provider>
  );
}

export default App;
cwomack commented 3 months ago

Hello, @SwhiteMHC and thanks for opening this issue. To your point that initializePushNotifications() calls fetchAuthSession() under the hood, can you confirm if you have guest access (i.e. unauth roles) enabled for you app?

SwhiteMHC commented 3 months ago

The invocation order was the problem. I needed to reorganize my code to ensure initializePushNotifications() was fired within my AuthenticationGateway component.

You can feel free to close. Thank you.