VirtusLab / besom

Besom - a Pulumi SDK for Scala. Also, incidentally, a broom made of twigs tied round a stick. Brooms and besoms are used for protection, to ward off evil spirits, and cleansing of ritual spaces.
https://virtuslab.github.io/besom/
Apache License 2.0
113 stars 7 forks source link

TypeError: address.split is not a function #493

Open novakov-alexey opened 1 month ago

novakov-alexey commented 1 month ago

aws-eks example fails with an error somewhere in TypeScript:

    Type                 Name                 Plan       Info
 +   pulumi:pulumi:Stack  aws-eks-aws-eks-dev  create     3 errors; 38 messages
 +   └─ awsx:ec2:Vpc      my-vpc               create

Diagnostics:
  pulumi:pulumi:Stack (aws-eks-aws-eks-dev):
    error: TypeError: address.split is not a function
        at Address4.parse (/snapshot/awsx/node_modules/ip-address/lib/ipv4.ts:61:28)
        at new Address4 (/snapshot/awsx/node_modules/ip-address/lib/ipv4.ts:43:31)
        at cidrSubnetV4 (/snapshot/awsx/bin/ec2/subnetDistributorLegacy.js:166:18)
        at getSubnetSpecsLegacy (/snapshot/awsx/bin/ec2/subnetDistributorLegacy.js:35:22)
        at /snapshot/awsx/bin/ec2/vpc.js:57:94
        at Vpc.initialize (/snapshot/awsx/bin/ec2/vpc.js:64:11)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    error: besom.internal.ResourceDecoder.resolve:97 [resource: my-vpc[awsx:ec2:Vpc]] Resolve resource: received error from gRPC call: 'UNKNOWN: address.split is not a function', failing resolution
    error: an unhandled error occurred: '/Users/.../Library/Application Support/Coursier/bin/scala-cli /Users/.../Library/Application Support/Coursier/bin/scala-cli run .' exited with non-zero exit code: 1

    Downloading https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala3-library_3/
    Downloaded https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala3-library_3/
    Exception in thread "main" io.grpc.StatusRuntimeException: UNKNOWN: address.split is not a function
        at io.grpc.Status.asRuntimeException(Status.java:537)
        at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:538)
        at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:567)
        at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:71)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:735)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:716)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

    2024.05.12 15:39:58:345 scala-execution-context-global-27 [resource: my-vpc[awsx:ec2:Vpc]] ERROR besom.internal.ResourceDecoder.resolve:97
        Resolve resource: received error from gRPC call: 'UNKNOWN: address.split is not a function', failing resolution
    2024.05.12 15:39:58:495 main  ERROR besom.internal.BesomModule.run:70
        io.grpc.StatusRuntimeException: UNKNOWN: address.split is not a function
            at io.grpc.Status.asRuntimeException(Status.java:537)
            at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:538)
            at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:567)
            at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:71)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:735)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:716)
            at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
            at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
            at java.lang.Thread.run(Thread.java:829)

    TypeError: address.split is not a function: TypeError: address.split is not a function
        at Address4.parse (/snapshot/awsx/node_modules/ip-address/lib/ipv4.ts:61:28)
        at new Address4 (/snapshot/awsx/node_modules/ip-address/lib/ipv4.ts:43:31)
        at cidrSubnetV4 (/snapshot/awsx/bin/ec2/subnetDistributorLegacy.js:166:18)
        at getSubnetSpecsLegacy (/snapshot/awsx/bin/ec2/subnetDistributorLegacy.js:35:22)
        at /snapshot/awsx/bin/ec2/vpc.js:57:94
        at Vpc.initialize (/snapshot/awsx/bin/ec2/vpc.js:64:11)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
lbialy commented 1 month ago

Thank you for reporting this! I'll take a look tomorrow.

lbialy commented 1 month ago

Finished research, this is a bigger problem related to how our codegen treats "plain": true fields in schemas (it ignores them). Related to https://github.com/VirtusLab/besom/issues/506