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

Resolve resource: received error from gRPC call - Calling [toString] on an [Output<T>] is not supported. #517

Open ryneflood opened 2 weeks ago

ryneflood commented 2 weeks ago

aws-eks example fails when running @ 0.3.2.

The same thing fails (creating an EKS cluster) on my project when trying to create an EKS cluster, although it works fine if I downgrade to 0.2.x.

View in Browser (Ctrl+O): https://app.pulumi.com/getvish/dev-base-cluster/dev-base-cluster/previews/9920533

     Type                     Name                               Plan       Info
     pulumi:pulumi:Stack      dev-base-cluster-dev-base-cluster             3 errors; 68 messages
 ~   └─ pulumi:providers:aws  ca-central-1                       update     [diff: ~version]

Diagnostics:
  pulumi:pulumi:Stack (dev-base-cluster-dev-base-cluster):
    2024.06.13 17:45:04:609 scala-execution-context-global-54 [resource: getvish-dev[eks:index:Cluster]] ER
        Resolve resource: received error from gRPC call: 'UNKNOWN: Invalid EC2 instance type: Calling [toSt
        ] on an [Output<T>] is not supported.
        To get the value of an Output<T> as an Output<string> consider either:
        1: o.apply(v => `prefix${v}suffix`)
        2: pulumi.interpolate `prefix${v}suffix`
        See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
        This function may throw in a future version of @pulumi/pulumi.', failing resolution
    2024.06.13 17:45:04:655 main  ERROR besom.internal.BesomModule.run:70
        io.grpc.StatusRuntimeException: UNKNOWN: Invalid EC2 instance type: Calling [toString] on an [Outpu
        ] is not supported.
        To get the value of an Output<T> as an Output<string> consider either:
        1: o.apply(v => `prefix${v}suffix`)
        2: pulumi.interpolate `prefix${v}suffix`
        See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
        This function may throw in a future version of @pulumi/pulumi.
                at io.grpc.Status.asRuntimeException(Status.java:533)
                at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:538)
                at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:564)
                at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72)
                at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(Clien
        ava:729)
                at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(Clie
        java:710)
                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:1136)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
                at java.lang.Thread.run(Thread.java:833)

    Error: Invalid EC2 instance type: Calling [toString] on an [Output<T>] is not supported.
    To get the value of an Output<T> as an Output<string> consider either:
    1: o.apply(v => `prefix${v}suffix`)
    2: pulumi.interpolate `prefix${v}suffix`
    See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
    This function may throw in a future version of @pulumi/pulumi.: Error: Invalid EC2 instance type: Calli
    To get the value of an Output<T> as an Output<string> consider either:
    1: o.apply(v => `prefix${v}suffix`)
    2: pulumi.interpolate `prefix${v}suffix`
    See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
    This function may throw in a future version of @pulumi/pulumi.
        at isGravitonInstance (/snapshot/eks/bin/nodegroup.js:1057:15)
        at getAMIType (/snapshot/eks/bin/nodegroup.js:1076:25)
        at getRecommendedAMI (/snapshot/eks/bin/nodegroup.js:1028:21)
        at createNodeGroupInternal (/snapshot/eks/bin/nodegroup.js:297:33)
        at createNodeGroup (/snapshot/eks/bin/nodegroup.js:155:12)
        at createCluster (/snapshot/eks/bin/cluster.js:861:60)
        at new ClusterInternal (/snapshot/eks/bin/cluster.js:929:25)
        at Object.construct (/snapshot/eks/bin/cmd/provider/cluster.js:21:29)
        at Provider.construct (/snapshot/eks/bin/cmd/provider/index.js:131:24)
        at Server.<anonymous> (/snapshot/eks/node_modules/@pulumi/pulumi/provider/server.js:315:52)

    error: besom.internal.ResourceDecoder.resolve:97 [resource: getvish-dev[eks:index:Cluster]] Resolve resource: received error from gRPC call: 'UNKNOWN: Invalid EC2 instance type: Calling [toString] on an [Output<T>] is not supported.

    To get the value of an Output<T> as an Output<string> consider either:
    1: o.apply(v => `prefix${v}suffix`)
    2: pulumi.interpolate `prefix${v}suffix`

    See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
    This function may throw in a future version of @pulumi/pulumi.', failing resolution
    error: an unhandled error occurred: '/home/ryne/.jenv/shims/java /home/ryne/.jenv/shims/java -jar target/scala-3.3.1/dev-base-cluster.jar' exited with non-zero exit code: 1
    error: Error: invocation of aws:ec2/getVpc:getVpc returned an error: grpc: the client connection is closing
        at Object.callback (/snapshot/eks/node_modules/@pulumi/pulumi/runtime/invoke.js:159:33)
        at Object.onReceiveStatus (/snapshot/eks/node_modules/@grpc/grpc-js/src/client.ts:360:26)
        at Object.onReceiveStatus (/snapshot/eks/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34)
        at Object.onReceiveStatus (/snapshot/eks/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
        at /snapshot/eks/node_modules/@grpc/grpc-js/src/resolving-call.ts:132:24
        at processTicksAndRejections (node:internal/process/task_queues:77:11)

    Exception in thread "main" io.grpc.StatusRuntimeException: UNKNOWN: Invalid EC2 instance type: Calling [toString] on an [Output<T>] is not supported.
    To get the value of an Output<T> as an Output<string> consider either:
    1: o.apply(v => `prefix${v}suffix`)
    2: pulumi.interpolate `prefix${v}suffix`
    See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
    This function may throw in a future version of @pulumi/pulumi.
        at io.grpc.Status.asRuntimeException(Status.java:533)
        at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:538)
        at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:564)
        at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:729)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:710)
        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:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

Also, if you just remove the instanceType it'll work fine, without being able to specify the instance type, as in:

    eks.ClusterArgs(
      // instanceType = "t2.medium",
      desiredCapacity = 2,
      minSize = 1,
      maxSize = 3,
      storageClasses = "gp2",
      instanceRole = instanceRole
    ),
lbialy commented 1 week ago

Hi. As far as I know this is an upstream issue that we have reported and it got fixed. I'll check if it was published already and generate a new EKS provider if it was.

ryneflood commented 1 week ago

Thanks. I believe I had tried in a Docker container to make sure that I was starting fresh/nothing from my environment was conflicting. Hopefully it's already been fixed, but if not I'm happy to post more info.

If anyone else happens to run into this right now, I was able to work around it by specifying nodeGroupOptions on the cluster which then successfully let me specify the instanceType, like:

  val cluster = eks.Cluster(
    "cluster",
    eks.ClusterArgs(
      nodeGroupOptions = ClusterNodeGroupOptionsArgs(
        instanceProfile = instanceProfile,
        desiredCapacity = 2,
        minSize = 1,
        maxSize = 3,
        instanceType = "t2.medium"
      )
    )
  )
lbialy commented 1 week ago

for reference: https://github.com/pulumi/pulumi-eks/issues/1160

lbialy commented 1 week ago

there was a new release of pulumi-eks last week: 2.7.1, let me get this published

lbialy commented 1 week ago

Ok, so this is fixed in 2.7.1, buuuuut https://github.com/VirtusLab/besom/issues/493 is not :( And that one is on our side, @PawelGizka is working on it.

lbialy commented 4 days ago

@PawelGizka can you test this one and #493 with current main (I merged #526 which fixes #493, hopefully)?

PawelGizka commented 4 days ago

Tested with current main, it works! Now we're thinking how to release it properly.