
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
- Function running in cloud but not locall...
Hi everyone, I have an appwrite function which is on python3.12 runtime. I have a library (hnswlib) which builds wheels during installation. This works on appwr...
- Permissions for bulk operation
Hi team, I have a question: “In the databases.createDocuments bulk API, can I set document-level permissions? If yes, how exactly should I include the permissio...
- Limit File Upload count?
Is there a way to limit the number of files a user can upload? I know there's a limit of file size but in my case I'd like to limit the user to only upload x am...
