lightbend / kalix-javascript-sdk

JavaScript and TypeScript SDKs for Kalix
https://docs.kalix.io/javascript/index.html
Apache License 2.0
22 stars 21 forks source link

Codegen failing on windows #442

Open johanandren opened 1 year ago

johanandren commented 1 year ago

Class not found when running codegen on windows only, reported in the forums: https://discuss.kalix.io/t/kalix-annotations-not-found/182

Building Typescript definitions from static JS with command: C:\data\kalix\shopping-cart\node_modules.bin\pbts C:\data\kalix\shopping-cart\lib\generated\proto.js -o C:\data\kalix\shopping-cart\lib\generated\proto.d.ts installing estraverse@^5.1.0 Invoking Kalix codegen with command: C:\data\kalix\shopping-cart\node_modules@kalix-io\kalix-scripts\bin\kalix-codegen-js.bin --proto-source-dir ./proto --source-dir ./src --generated-source-dir ./lib/generated --test-source-dir ./test --integration-test-source-dir ./integration-test Inspecting proto file descriptor for Kalix code generation… Exception in thread “main” java.lang.NoClassDefFoundError: kalix.Annotations at io.kalix.codegen.DescriptorSet$.$anonfun$fileDescriptors$2(DescriptorSet.scala:45) at scala.util.Using$.$anonfun$apply$1(Using.scala:261) at scala.util.Using$.apply(Using.scala:113) at io.kalix.codegen.DescriptorSet$.fileDescriptors(DescriptorSet.scala:43) at io.kalix.codegen.js.Cli$.main(Cli.scala:85) at io.kalix.codegen.js.Cli.main(Cli.scala) Running Invoking Kalix codegen failed, process: [C:\data\kalix\shopping-cart\node_modules@kalix-io\kalix-scripts\bin\kalix-codegen-js.bin], args: [–proto-source-dir,./proto,–source-dir,./src,–generated-source-dir,./lib/generated,–test-source-dir,./test,–integration-test-source-dir,./integration-test]

timppa67 commented 1 year ago

It seems that this is probablyt a known issue:

`

Known issues

Invoking Kalix codegen with command: /Users/francisco/Git/kalix-javascript-sdk/samples/js/js-replicated-entity-shopping-cart/node_modules/@kalix-io/kalix-scripts/bin/kalix-codegen-js.bin --proto-source-dir ./proto --source-dir ./src --generated-source-dir ./lib/generated --test-source-dir ./test
Inspecting proto file descriptor for Kalix code generation...
Exception in thread "main" java.lang.NoClassDefFoundError: kalix.Annotations

This happens when you generate the codegen with Java 17 instead of 11 and then you run npm run build on one of the samples.`

To verify this I used Java SDK 11 and rebuilt my own copy of codegen and it works on Windows. So this known issue seems to be a valid thing.

Is there any estimate / idea when that known issue would be fixed?

johanandren commented 1 year ago

Not entirely sure I follow.

The codegen is a native executable (using GraalVM) not using any local Java installation, are you saying you rebuilt an image of your own but based on a different GraalVM version than 22.1.0, or that you built the codegen Java library with JDK 17 first and then generated a new native image with the default GraalVM?