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
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- HTTP POST to function returning "No Appw...
Hi everyone, I’m running into an issue with my self-hosted Appwrite instance. I’ve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...