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

[sdk/go] Panic using StringPtr as input to pulumi.All #9192

Closed
lukehoban opened this issue Mar 14, 2022 · 1 comment · Fixed by #9197
Closed

[sdk/go] Panic using StringPtr as input to pulumi.All #9192

lukehoban opened this issue Mar 14, 2022 · 1 comment · Fixed by #9197
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec p1 Bugs severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Milestone

Comments

@lukehoban
Copy link
Member

The following program panics.

package main

import (
	"fmt"

	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

var defaulted = "<defaulted>"

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		aStringOutput := pulumi.String("Test").ToStringOutput()
		aStringPtrInput := pulumi.StringPtr("Hello World")

		derived := pulumi.All(aStringOutput, aStringPtrInput).ApplyT(func(vs []interface{}) string {
			first := vs[0].(string)
			second := vs[1].(*string)

			if second == nil {
				second = &defaulted
			}

			return fmt.Sprintf("%s %s", first, *second)
		}).(pulumi.StringOutput)

		ctx.Export("result", derived)
		return nil
	})
}
  pulumi:pulumi:Stack (repro-string-ptr-dev):
    panic: reflect: Elem of invalid type interface {}
    goroutine 25 [running]:
    reflect.(*rtype).Elem(0x1719900)
    	/opt/brew/Cellar/go/1.17.8/libexec/src/reflect/type.go:954 +0x134
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.awaitInputs({0x19314f8, 0xc00003c150}, {0x17514e0, 0xc0005b4590, 0x0}, {0x1719900, 0xc00068e080, 0x194})
    	/Users/James/Code/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:723 +0xbfe
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.awaitInputs({0x19314f8, 0xc00003c150}, {0x1719900, 0xc000528090, 0xc00051c000}, {0x1719900, 0xc00068e080, 0x194})
    	/Users/James/Code/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:742 +0x1125
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.awaitInputs({0x19314f8, 0xc00003c150}, {0x16e1160, 0xc0001820c0, 0x0}, {0x16e1160, 0xc0001820d8, 0x197})
    	/Users/James/Code/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:778 +0x1985
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.toOutputTWithContext.func3()
    	/Users/James/Code/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:849 +0x131
    created by github.com/pulumi/pulumi/sdk/v3/go/pulumi.toOutputTWithContext
    	/Users/James/Code/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:841 +0x365
    exit status 2

    error: an unhandled error occurred: program exited with non-zero exit code: 1
@lukehoban lukehoban added kind/bug Some behavior is incorrect or out of spec p1 Bugs severe enough to be the next item assigned to an engineer labels Mar 14, 2022
@lukehoban
Copy link
Member Author

This might be the same root cause as #7706?

@Frassle Frassle self-assigned this Mar 14, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Mar 16, 2022
@mikhailshilkov mikhailshilkov added this to the 0.70 milestone Apr 1, 2022
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 p1 Bugs severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants