Skip to content
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

Instance stackscriptId type error #281

Open
jchook opened this issue May 21, 2023 · 1 comment
Open

Instance stackscriptId type error #281

jchook opened this issue May 21, 2023 · 1 comment
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@jchook
Copy link

jchook commented May 21, 2023

What happened?

Type 'Output<string>' is not assignable to type 'number | Promise<number> | OutputInstance<number> | undefined'.
  Type 'Output<string>' is not assignable to type 'OutputInstance<number>'.
    Types of property 'apply' are incompatible.
      Type '{ <U>(func: (t: string) => Promise<U>): Output<U>; <U>(func: (t: string) => OutputInstance<U>): Output<U>; <U>(func: (t: string) => U): Output<...>; }' is not assignable to type '{ <U>(func: (t: number) => Promise<U>): Output<U>; <U>(func: (t: number) => OutputInstance<U>): Output<U>; <U>(func: (t: number) => U): Output<...>; }'.
        Types of parameters 'func' and 'func' are incompatible.
          Types of parameters 't' and 't' are incompatible.
            Type 'string' is not assignable to type 'number'. (tsserver 2322)

Expected Behavior

No type error.

Steps to reproduce

import * as linode from "@pulumi/linode";

export const appStackScript = new linode.StackScript("appStackScript", {
  description: "My App StackScript",
  label: "appStackScript",
  images: ["linode/debian11"],
  isPublic: false,
  script: '# ...',
});

export const app1 = new linode.Instance("app1", {
  image: "linode/debian11",
  label: "app1",
  region: "us-east",
  type: "g6-nanode-1",
  stackscriptId: appStackScript.id, // Type error here
});

Output of pulumi about

CLI          
Version      3.46.1-dev.0
Go Version   go1.19.2
Go Compiler  gc

Plugins
NAME    VERSION
linode  3.12.0
nodejs  unknown

Host     
OS       void
Version  
Arch     x86_64

This project is written in nodejs: executable='/home/jchook/.local/opt/n/bin/node' version='v16.19.1'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/jchook
User           jchook
Organizations  jchook

Dependencies:
NAME            VERSION
@types/node     16.18.31
@pulumi/linode  3.12.0
@pulumi/pulumi  3.68.0

Pulumi locates its logs in /tmp by default

Additional context

I would like to create a StackScript and then apply it to an instance.

I don't fully understand technical details of the issue, but this seems like a bug to me.

Potential workaround:

export const app1 = new linode.Instance("app1", {
  // ...
  stackscriptId: appStackScript.id.apply(id => parseInt(id)),
}

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@jchook jchook added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels May 21, 2023
@aq17
Copy link
Contributor

aq17 commented May 22, 2023

Hi @jchook , thanks for opening the issue. The workaround you suggested is correct – the issue is with how we are generating our diff strategy. Since network.id is unknown during preview, the apply also generates an unknown value.
We are tracking this issue here.

@aq17 aq17 removed needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec labels May 22, 2023
@mnlumi mnlumi added the kind/bug Some behavior is incorrect or out of spec label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants