You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AWSAppSyncClient to perform API calls, using ClientFactory.java. Error in logcat reads "Please check the AppSync configuration in awsconfiguration.json."
#277
Open
tonyyhliu opened this issue
May 11, 2020
· 0 comments
Hi,
I am using AWS Amplify and came across some issues. My app logs in perfectly and on restarting the app, the UserState is SIGNED_IN
But when I try to build an appsync client it gives the following exception:
Please check the AppSync configuration in awsconfiguration.json.
I've copied the code from the AWS Amplify Docs, and my code is the following in ClientFactory.java:
public static synchronized void init(final Context context) {
if (client == null) {
final AWSConfiguration awsConfiguration = new AWSConfiguration(context);
client = AWSAppSyncClient.builder()
.context(context)
.awsConfiguration(awsConfiguration)
.cognitoUserPoolsAuthProvider(new CognitoUserPoolsAuthProvider() { @OverRide
public String getLatestAuthToken() {
try {
return AWSMobileClient.getInstance().getTokens().getIdToken().getTokenString();
} catch (Exception e){
Log.e("APPSYNC_ERROR", e.getLocalizedMessage());
return e.getLocalizedMessage();
}
}
}).build();
}
}
My logcat has the following messages:
Caused by: java.lang.RuntimeException: Please check the AppSync configuration in awsconfiguration.json. at com.amazonaws.mobileconnectors.appsync.AWSAppSyncClient$Builder.build(AWSAppSyncClient.java:485) at com.example.events.ClientFactory.init(ClientFactory.java:31) at com.example.events.MainActivity.onCreate(MainActivity.java:69) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.RuntimeException: Found conflicting AuthMode. Should be API_KEY but you selected AMAZON_COGNITO_USER_POOLS
My app crashes on start and I'm not quite sure how to fix this. Any advice would be greatly appreciated!
The text was updated successfully, but these errors were encountered:
Hi,
I am using AWS Amplify and came across some issues. My app logs in perfectly and on restarting the app, the UserState is SIGNED_IN
But when I try to build an appsync client it gives the following exception:
I've copied the code from the AWS Amplify Docs, and my code is the following in ClientFactory.java:
My logcat has the following messages:
Caused by: java.lang.RuntimeException: Please check the AppSync configuration in awsconfiguration.json. at com.amazonaws.mobileconnectors.appsync.AWSAppSyncClient$Builder.build(AWSAppSyncClient.java:485) at com.example.events.ClientFactory.init(ClientFactory.java:31) at com.example.events.MainActivity.onCreate(MainActivity.java:69) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.RuntimeException: Found conflicting AuthMode. Should be API_KEY but you selected AMAZON_COGNITO_USER_POOLS
My app crashes on start and I'm not quite sure how to fix this. Any advice would be greatly appreciated!
The text was updated successfully, but these errors were encountered: