Skip to content

Conversation

SalvatoreT
Copy link
Contributor

@SalvatoreT SalvatoreT commented Aug 24, 2025

@SalvatoreT SalvatoreT force-pushed the salvatoret/bump-kotlin-version branch from d811305 to c5559f1 Compare August 29, 2025 05:10
@StefanOltmann
Copy link

StefanOltmann commented Aug 31, 2025

I didn't saw your PR when I created mine.
Your one looks more modern, so I just tried it.

Unfortunately wrangler dev doesn't work for me.
The resulting webpage crashes with this error:

ReferenceError {

  stack: 'ReferenceError: HelloWorker is not defined\n' +
  '    at Object.fetch (file:///C:/Users/Stefan/Downloads/kotlin-worker-hello-world-salvatoret-bump-kotlin-version/build/js/packages/kotlin-worker-hello-world/kotlin/kotlin-worker-hello-world.mjs:4:9)',
  message: 'HelloWorker is not defined',
  cause: undefined,
  name: 'ReferenceError',
}

Also, please consider removing the ./ in front of ./gradlew to make it work on Windows, too.

@SalvatoreT
Copy link
Contributor Author

Unfortunately wrangler dev doesn't work for me.

I'm guessing yours didn't compile properly? I don't really have enough information.

It works fine for me!

❯ wrangler dev

 ⛅️ wrangler 4.33.2
───────────────────
[custom build] Running: ./gradlew :compileProductionExecutableKotlinJs
[custom build] Reusing configuration cache.
[custom build]
[custom build] > Task :checkKotlinGradlePluginConfigurationErrors SKIPPED
[custom build] > Task :jsProcessResources NO-SOURCE
[custom build] > Task :compileKotlinJs UP-TO-DATE
[custom build] > Task :jsMainClasses UP-TO-DATE
[custom build] > Task :compileProductionExecutableKotlinJs UP-TO-DATE
[custom build] > Task :jsProductionExecutableCompileSync UP-TO-DATE
[custom build]
[custom build] BUILD SUCCESSFUL in 296ms
[custom build] 3 actionable tasks: 3 up-to-date
[custom build] Configuration cache entry reused.
[custom build]
╭──────────────────────────────────────────────────────────────────────╮
│  [b] open a browser [d] open devtools [c] clear console [x] to exit  │
╰──────────────────────────────────────────────────────────────────────╯
The file src changed, restarting build...
[custom build] Running: ./gradlew :compileProductionExecutableKotlinJs
[custom build] Reusing configuration cache.
[custom build]
[custom build] > Task :checkKotlinGradlePluginConfigurationErrors SKIPPED
[custom build] > Task :jsProcessResources NO-SOURCE
[custom build] > Task :compileKotlinJs UP-TO-DATE
[custom build]
[custom build] > Task :jsMainClasses UP-TO-DATE
[custom build] > Task :compileProductionExecutableKotlinJs UP-TO-DATE
[custom build] > Task :jsProductionExecutableCompileSync UP-TO-DATE
[custom build]
[custom build] BUILD SUCCESSFUL in 363ms
[custom build] 3 actionable tasks: 3 up-to-date
[custom build]
[custom build]
[custom build] Configuration cache entry reused.
[custom build]
⎔ Starting local server...
[wrangler:info] Ready on http://localhost:8787
[wrangler:info] GET / 200 OK (3ms)
[wrangler:info] GET / 200 OK (2ms)
[wrangler:info] GET /favicon.ico 200 OK (2ms)
Screenshot 2025-09-02 at 10 25 21 PM

Also, please consider removing the ./ in front of ./gradlew to make it work on Windows, too.

Then it'll stop working on macOS. 😞

diff --git i/wrangler.toml w/wrangler.toml
index f8e675a..cc0129a 100644
--- i/wrangler.toml
+++ w/wrangler.toml
@@ -4,4 +4,4 @@ compatibility_date = "2025-08-24"
 main = "build/js/packages/kotlin-worker-hello-world/kotlin/kotlin-worker-hello-world.mjs"
 
 [build]
-command = "./gradlew :compileProductionExecutableKotlinJs"
\ No newline at end of file
+command = "gradlew :compileProductionExecutableKotlinJs"
\ No newline at end of file

results in

❯ wrangler dev

 ⛅️ wrangler 4.33.2
───────────────────
[custom build] Running: gradlew :compileProductionExecutableKotlinJs
[custom build] /bin/sh: gradlew: command not found
[custom build]
✘ [ERROR] Error: Command failed with exit code 127: gradlew :compileProductionExecutableKotlinJs

  /bin/sh: gradlew: command not found
      at makeError
  (/opt/homebrew/Cellar/cloudflare-wrangler/4.33.2/libexec/lib/node_modules/wrangler/wrangler-dist/cli.js:64909:18)
      at handlePromise
  (/opt/homebrew/Cellar/cloudflare-wrangler/4.33.2/libexec/lib/node_modules/wrangler/wrangler-dist/cli.js:65387:29)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async runCustomBuild

@StefanOltmann
Copy link

Yes, the issue turned out to be that some names are hard-coded and depend on how the checkout name is.
It helps to set the root project name.

I did that now in https://github.com/StefanOltmann/cloudflare-steam-name-update-service and got it working.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to deploy to Cloudflare, no event handlers registered
2 participants