1

We have a very simple test in kotlinJs to check that a function we have in Javascript is read into kotlin and returns something:

JS code:

function: makeKey = (num) => { return 1000 + num }

Kotlin FFI code:

@JsNonModule
external object MyApp {
    fun makeKey(num: Int): Int
}

Test Code:

class TestFFI {
    @Test
    fun thingsShouldWork() {
        println(MyApp.makeKey(5))
        assertNotNull(MyApp.makeKey(5))
        assertEquals(1005, MyApp.makeKey(5))
    }
}

This works locally but when we put this into a google cloud run we get the following failure: ReferenceError: setMetadataFor is not defined

setMetadataFor appears to be a function in the testJs file that is produced by the kotlin compiler and is defined as

var setMetadataFor = kotlin_kotlin.$_$.t9;

We are wondering if the Kotlin code is getting packaged wrong and not including the relevant file

We are using Kotlin 1.8 and Gradle 7.4.

0 Answers0