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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need better error messages for python when property values are the wrong type. #15156

Closed
MitchellGerdisch opened this issue Jan 16, 2024 · 3 comments 路 Fixed by #16098
Closed
Assignees
Labels
area/sdks Pulumi language SDKs customer/feedback Feedback from customers customer/lighthouse Lighthouse customer bugs kind/enhancement Improvements or new features language/python resolution/fixed This issue was fixed

Comments

@MitchellGerdisch
Copy link

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

When an incorrect type is specified for a python program one gets output like this:

pulumi:pulumi:Stack (aks-cluster-sc-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/home/pulumiGuy/.pulumi/bin/pulumi-language-python-exec", line 197, in <module>
        loop.run_until_complete(coro)
      File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
        return future.result()
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 137, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
        await wait_for_rpcs()
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 121, in wait_for_rpcs
        raise exception
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/rpc_manager.py", line 71, in rpc_wrapper
        result = await rpc
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/resource.py", line 872, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/resource.py", line 176, in prepare_resource
        serialized_props = await rpc.serialize_properties(
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 213, in serialize_properties
        result = await serialize_property(
      File "/builds/goo/devsecops/pulumi/azure/aks-cluster/aks-cluster-sc/venv/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 576, in serialize_property
        raise ValueError(f"unexpected input of type {type(value).__name__}")
    ValueError: unexpected input of type method

It can be extremely difficult to locate the issue.

Generating error messages that point to the specific property or similar is needed.

Affected area/feature

@MitchellGerdisch MitchellGerdisch added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Jan 16, 2024
@Frassle
Copy link
Member

Frassle commented Jan 16, 2024

We should be able to give a better message here like "unexpected input of type method for property ExampleType.example_field". Just means threading through some context information into serializeProperty/Properties.

@Frassle Frassle added area/sdks Pulumi language SDKs language/python and removed needs-triage Needs attention from the triage team labels Jan 16, 2024
@zbuchheit zbuchheit added customer/feedback Feedback from customers customer/lighthouse Lighthouse customer bugs labels Feb 14, 2024
@kvthr
Copy link
Contributor

kvthr commented Apr 29, 2024

Hey @Frassle, can I work on this issue?

@Frassle
Copy link
Member

Frassle commented Apr 29, 2024

I don't think anyone else is, so sure.

github-merge-queue bot pushed a commit that referenced this issue May 10, 2024
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes #15156 

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sdks Pulumi language SDKs customer/feedback Feedback from customers customer/lighthouse Lighthouse customer bugs kind/enhancement Improvements or new features language/python resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants