pulumi-command icon indicating copy to clipboard operation
pulumi-command copied to clipboard

output in triggers throws error if `PULUMI_ERROR_OUTPUT_STRING` is set

Open otahirs opened this issue 1 year ago • 3 comments

What happened?

when PULUMI_ERROR_OUTPUT_STRING="true" option is used, and there is an output in the triggers array, the pulumi throws an error that toString was called on an Output

Example

set env variable PULUMI_ERROR_OUTPUT_STRING="true"

have output in the triggers array

const iMightChange = pulumi.output("foo");

const cmd = new command.local.Command(
    `cmd`,
    {
      triggers: [iMightChange],
      interpreter: ['PowerShell', '-Command'],
      create: '', 
    },
    {},
  );

you get error: Image minimal_working_example.zip

Output of pulumi about

CLI Version 3.133.0 Go Version go1.23.1 Go Compiler gc

Plugins KIND NAME VERSION resource command 1.0.1 language nodejs unknown

Host OS Microsoft Windows 11 Enterprise Version 10.0.22631 Build 22631 Arch x86_64

This project is written in nodejs: executable='C:\Program Files\nodejs\node.exe' version='v20.15.0'

Current Stack: organization/temp/dev

TYPE URN pulumi:pulumi:Stack urn:pulumi:dev::temp::pulumi:pulumi:Stack::temp-dev pulumi:providers:command urn:pulumi:dev::temp::pulumi:providers:command::default_1_0_1 command:local:Command urn:pulumi:dev::temp::command:local:Command::cmd

Additional context

workaround is to wrap the whole array in an output

const cmd = new command.local.Command(
    `cmd`,
    {
      triggers: pulumi.output([iMightChange]),
      interpreter: ['PowerShell', '-Command'],
      create: '', 
    },
    {},
  );

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).

otahirs avatar Oct 18 '24 09:10 otahirs