Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on AWSMobileClient when initialising at runtime. #5458

Open
RuiAAPeres opened this issue Oct 29, 2024 · 1 comment
Open

Crash on AWSMobileClient when initialising at runtime. #5458

RuiAAPeres opened this issue Oct 29, 2024 · 1 comment
Labels
bug Something isn't working pinpoint Issues related to AWS Pinpoint

Comments

@RuiAAPeres
Copy link

RuiAAPeres commented Oct 29, 2024

State your question

We are currently initialising AWPinpoint dynamically (i.e. without the use of JSON files). We do this, because the configuration is dependant on a few conditions that are only available at a later point. We do the following:

let localConfiguration = AWSConfiguration.configuration

let credentialsProvider = AWSCognitoCredentialsProvider(regionType: localConfiguration.cognitoPoolRegion.toAWSRegionType,
                                                                identityPoolId: localConfiguration.cognitoPoolId)

let configuration = AWSServiceConfiguration(region: localConfiguration.pinpointRegion.toAWSRegionType,
                                                    credentialsProvider: credentialsProvider)

AWSServiceManager.default().defaultServiceConfiguration = configuration
pinpointConfiguration = AWSPinpointConfiguration(appId: localConfiguration.pinpointAppId, launchOptions: launchOptions)

/// later on:
pinpoint = configuration.pinpoint /// AWSPinpoint
pinpointAnalyticsClient = configuration.analyticsClient /// AWSPinpointAnalyticsClient

My AWSConfiguration has the following shape:

struct AWSConfiguration {
    let cognitoPoolId: String
    let cognitoPoolRegion: String
    let pinpointAppId: String
    let pinpointRegion: String
}

At a later point, we call this:

AWSMobileClient.default().interceptApplication(application, didFinishLaunchingWithOptions: options)

The above call works fine in DEBUG mode, but it's crashing in RELEASE with the following:

Thread 1: "The service configuration is `nil`. You need to configure `awsconfiguration.json` or `Info.plist` before using this method."
image

This is how our awsconfiguration.json looked (before removing it):

{
  "UserAgent": "MobileHub/1.0",
  "Version": "1.0",
  "CredentialsProvider": {
    "CognitoIdentity": {
      "Default": {
        "PoolId": "eu-west-xyz",
        "Region": "eu-west-1"
      }
    }
  },
  "IdentityManager": {
    "Default": {}
  },
  "PinpointAnalytics": {
    "Default": {
      "AppId": "pyx",
      "Region": "us-east-1"
    }
  },
  "PinpointTargeting": {
    "Default": {
      "Region": "us-east-1"
    }
  }
}

Question:

  1. Is there something special happening in Release?
  2. Do I even need to call AWSMobileClient.default().interceptApplication? We only use AWSPinpoint.

Which AWS Services are you utilizing?

I am using AWSPinpoint.

Provide code snippets (if applicable)

Environment(please complete the following information):

  • SDK Version: 2.37.1
  • Dependency Manager: SPM
  • Swift Version : 5.0

Device Information (please complete the following information):

  • Device: Simulator iPhone Pro
    • iOS Version: iOS 17.5
@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Oct 29, 2024
@edisooon edisooon added bug Something isn't working pinpoint Issues related to AWS Pinpoint and removed pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Oct 30, 2024
@edisooon
Copy link
Member

Hi @RuiAAPeres, thank you for submitting this ticket! One of our team members will do some investigation on this as soon as possible.
Meanwhile, could you provide more log information from the crashes? This might help us identify the issue more easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinpoint Issues related to AWS Pinpoint
Projects
None yet
Development

No branches or pull requests

2 participants