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

Setting ClientDatabasePrefix via builder causes crash if configuration is present #306

Closed
mslagle-godaddy opened this issue Aug 12, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@mslagle-godaddy
Copy link
Contributor

mslagle-godaddy commented Aug 12, 2020

Describe the bug
Setting a clientDatabasePrefix programmatically causes a crash if there is a configuration

To Reproduce
Steps to reproduce the behavior:

AWSAppSyncClient.builder()
                .context(context)
                .awsConfiguration(appSyncConfig)
                .region(fromName(awsRegion))
                .serverUrl(awsEndpoint)
                .credentialsProvider(credentialsProvider)
                .clientDatabasePrefix("SomePrefix")
                .useClientDatabasePrefix(true)
                .build()

Expected behavior
It sets the clientDatabasePrefix on the builder, that prefix is used, and the library doesn't throw an error.

Environment(please complete the following information):

  • AppSync SDK Version: 3.1.0

Device Information (please complete the following information):

  • Device: Pixel 3, Simulator
  • Android Version: 10

Additional context
The issue is here. If you set the clientDatabasePrefix using the Builder.clientDatabasePrefix() method, but have a config, then it overrides your previously set value with null instead of checking if one is already set programmatically.

Caused by: java.lang.RuntimeException: Please check the AppSync configuration in awsconfiguration.json.
        at com.amazonaws.mobileconnectors.appsync.AWSAppSyncClient$Builder.build(AWSAppSyncClient.java:589)
        at com.godaddy.leka.appsync.AppSyncRegistrationCoordinator$registerAppSyncClient$$inlined$registerWithOverride$1$1.invoke(DependencyService.kt:361)
        at com.godaddy.leka.appsync.AppSyncRegistrationCoordinator$registerAppSyncClient$$inlined$registerWithOverride$1$1.invoke(DependencyService.kt:115)
        at org.koin.core.instance.DefinitionInstance.create(DefinitionInstance.kt:54)
        	... 44 more
     Caused by: java.lang.RuntimeException: ClientDatabasePrefix is not present in AppSync configuration in awsconfiguration.json however .useClientDatabasePrefix(true) is passed in.
        at com.amazonaws.mobileconnectors.appsync.AWSAppSyncClient$Builder.build(AWSAppSyncClient.java:564)
@jamesonwilliams
Copy link
Contributor

@rjuliano Does #308 resolve #306? Do we just need to release it?

@rjuliano
Copy link
Contributor

@rjuliano Does #308 resolve #306? Do we just need to release it?

That's correct.

@jamesonwilliams
Copy link
Contributor

Released in 3.1.1.

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

No branches or pull requests

3 participants