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

Cannot access 'val data: Any?': it is private in 'com/google/firebase/functions/HttpsCallableResult' #6522

Open
thatfiredev opened this issue Nov 18, 2024 · 1 comment
Assignees

Comments

@thatfiredev
Copy link
Member

[REQUIRED] Step 2: Describe your environment

  • Firebase Component: Functions
  • Component version: 21.1.0

[REQUIRED] Step 3: Describe the problem

Functions SDK version 21.1.0 seems to have broken source compatibility. Specifically when using HttpsCallableResult:

Version 21.0.0

suspend fun addMessage(text: String) {
    val data = hashMapOf("text" to text)

    val result = functions
        .getHttpsCallable("addMessage")
        .call(data)
        .await()

    val data = result?.data // <-- WORKS
}

Version 21.1.0

suspend fun addMessage(text: String) {
    val data = hashMapOf("text" to text)

    val result = functions
        .getHttpsCallable("addMessage")
        .call(data)
        .await()

    val data = result?.data // <-- Cannot access 'val data: Any?': it is private in 'com/google/firebase/functions/HttpsCallableResult'
}

Spotted in https://github.com/firebase/quickstart-android/actions/runs/11883012926/job/33109208274

@emilypgoogle
Copy link
Collaborator

This seems to be related to how Kotlin coerces Java's functions into field accesses. A java function called foo.getData() can be accessed as foo.data from Kotlin. However, if the code is compiled from Kotlin, you need to explicitly provide the getters. The released changes for Functions should be binary compatible but as shown, not source compatible for Kotlin consumers. This shouldn't affect Java users. Existing tooling doesn't exist to make sure this isn't broken and only focused on Java compatibility. The fix is both fixing this specific case and checking the rest of the SDK for instances where the conversion may have caused this, which I'll work on for the next Firebase release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants