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

refresh breaks Command.assets #537

Open
RafalSumislawski opened this issue Sep 13, 2024 · 1 comment
Open

refresh breaks Command.assets #537

RafalSumislawski opened this issue Sep 13, 2024 · 1 comment
Labels
awaiting/core Blocked on a missing bug or feature in pulumi/pulumi (except codegen) awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec

Comments

@RafalSumislawski
Copy link

RafalSumislawski commented Sep 13, 2024

What happened?

Give a code that attempts to use the assets output of a Command resource:

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

new command.local.Command(`test-file`, {
    create: "touch test.txt",
    assetPaths: ["test.txt"],
}).assets.apply(assets => {
    assets
});

running a sequence of

pulumi up
pulumi refresh
pulumi up

Leads to a Invalid asset encountered when unmarshaling resource property error.

This is most likely related to the fact that running a refresh removes the path property of the asset

Before:

                        "assets": {
                            "test.txt": {
                                "4dabf18193072939515e22adb298388d": "c44067f5952c0a294b673a41bacd8c17",
                                "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                                "path": "/Users/rsum/pulumi/main/test.txt"
                            }
                        },

After:

                        "assets": {
                            "test.txt": {
                                "4dabf18193072939515e22adb298388d": "c44067f5952c0a294b673a41bacd8c17",
                                "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
                            }
                        },

Example

% pulumi up                         
Previewing update (rafal):
     Type                      Name            Plan       
 +   pulumi:pulumi:Stack       command-test-rafal  create     
 +   └─ command:local:Command  test-file       create     

Resources:
    + 2 to create

Do you want to perform this update? yes
Updating (rafal):
     Type                      Name            Status              
 +   pulumi:pulumi:Stack       command-test-rafal  created (1s)        
 +   └─ command:local:Command  test-file       created (0.09s)     

Resources:
    + 2 created

Duration: 2s

% pulumi refresh
Previewing refresh (rafal):
     Type                      Name            Plan     
     pulumi:pulumi:Stack       command-test-rafal           
     └─ command:local:Command  test-file                

Resources:
    2 unchanged

Do you want to perform this refresh?
No resources will be modified as part of this refresh; just your stack's state will be.
 yes
Refreshing (rafal):
     Type                      Name            Status     
     pulumi:pulumi:Stack       command-test-rafal             
     └─ command:local:Command  test-file                  

Resources:
    2 unchanged

Duration: 1s

% pulumi up     
Previewing update (rafal):
     Type                 Name            Plan     Info
     pulumi:pulumi:Stack  command-test-rafal           1 error

Diagnostics:
  pulumi:pulumi:Stack (command-test-rafal):
    error: Running program '/Users/rsum/pulumi/main/index.ts' failed with an unhandled exception:
    <ref *1> Error: Invalid asset encountered when unmarshaling resource property
        at deserializeProperty (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/runtime/rpc.ts:636:31)
        at deserializeProperty (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/runtime/rpc.ts:732:23)
        at Object.deserializeProperties (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/runtime/rpc.ts:200:24)
        at /Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/runtime/resource.ts:1104:33
        at Generator.next (<anonymous>)
        at /Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/pulumi/runtime/resource.js:21:71
        at new Promise (<anonymous>)
        at __awaiter (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/pulumi/runtime/resource.js:17:12)
        at resolveOutputs (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/pulumi/runtime/resource.js:797:12)
        at Object.<anonymous> (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/runtime/resource.ts:701:23)
        at Generator.next (<anonymous>)
        at fulfilled (/Users/rsum/pulumi/main/node_modules/.pnpm/@pulumi+pulumi@3.131.0_typescript@5.5.4/node_modules/@pulumi/pulumi/runtime/resource.js:18:58)
        at processTicksAndRejections (node:internal/process/task_queues:95:5) {
      promise: Promise { <rejected> [Circular *1] }
    }


### Output of `pulumi about`

pulumi about
CLI          
Version      3.132.0
Go Version   go1.23.1
Go Compiler  gc

Plugins
KIND      NAME     VERSION
resource  command  1.0.1
resource  gcp      7.38.0
language  nodejs   unknown

Host     
OS       darwin
Version  14.6.1
Arch     arm64

This project is written in nodejs: executable='/Users/rsum/.nvm/versions/node/v18.13.0/bin/node' version='v18.13.0'

Current Stack: organization/command-test/rafal

TYPE                      URN
pulumi:pulumi:Stack       urn:pulumi:rafal::command-test::pulumi:pulumi:Stack::command-test-rafal
pulumi:providers:command  urn:pulumi:rafal::command-test::pulumi:providers:command::default_1_0_1
command:local:Command     urn:pulumi:rafal::command-test::command:local:Command::test-file


Found no pending operations associated with rafal

Backend        
Name           Rafas-MacBook-Pro.local
URL            file://~
User           rsum
Organizations  
Token type     personal

Pulumi locates its logs in /var/folders/bk/z20y93815gnglbl_xdtjwjjh0000gn/T/ by default
warning: Failed to get information about the Pulumi program's dependencies: could not find either /Users/rsum/pulumi/main/yarn.lock or /Users/rsum/pulumi/main/package-lock.json

### Additional context

_No response_

### 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). 
@RafalSumislawski RafalSumislawski added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Sep 13, 2024
@mjeffryes
Copy link
Member

Thanks for the bug report @RafalSumislawski. I think the root cause here is pulumi/pulumi#17131 I'll keep this open as a pointer for other users, but I suggest, upvoting and adding any additional context on that ticket.

@mjeffryes mjeffryes added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). awaiting/core Blocked on a missing bug or feature in pulumi/pulumi (except codegen) and removed needs-triage Needs attention from the triage team labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting/core Blocked on a missing bug or feature in pulumi/pulumi (except codegen) awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants