pulumi / pulumi-ai

226 stars 16 forks source link

TypeError: Cannot read properties of undefined (reading 'Cluster') #38

Closed d3287t328 closed 1 year ago

d3287t328 commented 1 year ago

What happened?

It does not know how to handle this:

> show me everything
TypeError: Cannot read properties of undefined (reading 'Cluster')
    at eval (eval at requireFromString (/home/a/code/pulumi-ai/src/index.ts:71:9), <anonymous>:5:29)
    at requireFromString (/home/a/code/pulumi-ai/src/index.ts:71:9)
    at PulumiAI.<anonymous> (/home/a/code/pulumi-ai/src/index.ts:311:47)
    at Generator.next (<anonymous>)
    at /home/a/code/pulumi-ai/lib/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/a/code/pulumi-ai/lib/index.js:4:12)
    at Object.stack.workspace.program [as init] (/home/a/code/pulumi-ai/src/index.ts:311:46)
    at Stack.<anonymous> (/home/a/code/pulumi-ai/node_modules/@pulumi/runtime/stack.ts:76:39)
    at Generator.next (<anonymous>)

Expected Behavior

Not this

Steps to reproduce

run the command

Output of pulumi about

try yourself

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

lukehoban commented 1 year ago

That error message indicates that the AI generated code that didn't work correctly. You can use !program to see what it generated - and can ask it as follow up That resulted in "Cannot read properties of undefined (reading 'Cluster')". Can you fix it? to guide the AI to fix the problem for you.

We do want to make continued improvements to reduce the likelihood that it generates code that fails, but it will always be possible for this to happen in some cases.

I've opened https://github.com/pulumi/pulumi-ai/issues/39 as an enhancement to track the idea of automatically asking the AI to handle errors if they are raised. Today you can do that yourself, but the UX could be nicer if this happened automatically.