-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fails to deploy to Cloudflare, no event handlers registered #4
Comments
I am getting the same issue. Kotlin/JS does not seem to generate the JS file in the format that Cloudflare Workers expects. Edit: fun main() {
@Suppress("UNUSED_VARIABLE")
val eventListener = EventListener {event ->
event.asDynamic().respondWith(fetch(event.asDynamic().request as Request))
Unit
}
js("addEventListener('fetch', eventListener)")
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following the instructions in the README results in the following error.
No event handlers were registered. This script does nothing.
Cloudflare accepts two formats for a worker. Service Worker where an event listener for fetch events must be registered or ES modules. This example worker needs to be expanded to include the event listener.
As an aside, the new support for
useEsModules()
in KotlinJS would be great but it doesn't yet create a module with a default export which Cloudflare requires.The text was updated successfully, but these errors were encountered: