My function structure looks like this:
kotlin
- src
- Main.kt
- static
- index.html
Entry point for the function is src/Main.kt
I'm getting java.lang.reflect.InvocationTargetException and Caused by: java.io.FileNotFoundException: ../static/index.html (No such file or directory) errors.
The code I'm using to read files is:
val text = File("../static/index.html").readText()
I've also tried
val fileName = Paths.get("..", "static", "index.html")
val fileString = Files.readString(fileName)
and many others without any luck.
For anyone else finding this, the problem is the kotlin code is compiled into a jar and static files included in your function aren't bundled into the jar. We may need to update open runtimes to add support for static files.
Recommended threads
- Bug: Cloud Function On Schedule Didn't R...
Heya I have a cloud function with this cron `0 17 * * *` to run at 9AM PT every day. I have not touched this since I set it up, and it has been working fine s...
- functions
Code for function not being created in Github. Permissions are set correctly, repository is created, however no code is in the created repository. Just trying...
- Urgent help required - Could not resolve...
I upgraded my production environment to 1.8.0 but experienced issues with appwrite running out of worker threads. I downgraded back to 1.6.1 and restored the da...