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

Attempt resource method on provider #265

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Aug 20, 2024

It seems like this doesn't work, since the Provider doesn't see the resulting
Call. Instead, the built-in pulumi provider receives the Call, then errors:

`pulumi up` result
$ pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/pulumi/dev/dev/previews/490ebc68-af05-49e7-96a2-e6182339ce67

Loading policy packs...

     Type                      Name               Plan       Info
 +   pulumi:pulumi:Stack       dev-dev            create     1 error
 +   └─ pulumi:providers:test  explicit-provider  create

Policies:
[email protected]

Diagnostics:
  pulumi:pulumi:Stack (dev-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 361, in do_rpc_call
        return monitor.Call(req)
               ^^^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/grpc/_channel.py", line 1160, in __call__
        return _end_unary_response_blocking(state, call, False, None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/grpc/_channel.py", line 1003, in _end_unary_response_blocking
        raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "call of pulumi:providers:test/makePet returned an error: the builtin provider does not implement call"
        debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-08-20T17:33:11.944431+02:00", grpc_status:2, grpc_message:"call of pulumi:providers:test/makePet returned an error: the builtin provider does not implement call"}"
    >

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/ianwahbe/go/bin/pulumi-language-python-exec", line 197, in <module>
        loop.run_until_complete(coro)
      File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 142, in run_in_stack
        await run_pulumi_func(run)
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 56, in run_pulumi_func
        await wait_for_rpcs()
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 118, in wait_for_rpcs
        await task
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 366, in do_call
        resp = await asyncio.get_event_loop().run_in_executor(None, do_rpc_call)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 363, in do_rpc_call
        handle_grpc_error(exn)
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/settings.py", line 307, in handle_grpc_error
        raise grpc_error_to_exception(exn)
    Exception: call of pulumi:providers:test/makePet returned an error: the builtin provider does not implement callg

@iwahbe iwahbe self-assigned this Aug 20, 2024
It seems like this doesn't work, since the Provider doesn't see the resulting
`Call`. Instead, the built-in `pulumi` provider receives the `Call`, then errors:

<details>
<summary> `pulumi up` result </summary>

```console
$ pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/pulumi/dev/dev/previews/490ebc68-af05-49e7-96a2-e6182339ce67

Loading policy packs...

     Type                      Name               Plan       Info
 +   pulumi:pulumi:Stack       dev-dev            create     1 error
 +   └─ pulumi:providers:test  explicit-provider  create

Policies:
    ✅ [email protected]

Diagnostics:
  pulumi:pulumi:Stack (dev-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 361, in do_rpc_call
        return monitor.Call(req)
               ^^^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/grpc/_channel.py", line 1160, in __call__
        return _end_unary_response_blocking(state, call, False, None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/grpc/_channel.py", line 1003, in _end_unary_response_blocking
        raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "call of pulumi:providers:test/makePet returned an error: the builtin provider does not implement call"
        debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-08-20T17:33:11.944431+02:00", grpc_status:2, grpc_message:"call of pulumi:providers:test/makePet returned an error: the builtin provider does not implement call"}"
    >

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/ianwahbe/go/bin/pulumi-language-python-exec", line 197, in <module>
        loop.run_until_complete(coro)
      File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 142, in run_in_stack
        await run_pulumi_func(run)
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 56, in run_pulumi_func
        await wait_for_rpcs()
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 118, in wait_for_rpcs
        await task
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 366, in do_call
        resp = await asyncio.get_event_loop().run_in_executor(None, do_rpc_call)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 363, in do_rpc_call
        handle_grpc_error(exn)
      File "/Users/ianwahbe/go/src/github.com/pulumi/pulumi-go-provider/examples/call/consumer/venv/lib/python3.12/site-packages/pulumi/runtime/settings.py", line 307, in handle_grpc_error
        raise grpc_error_to_exception(exn)
    Exception: call of pulumi:providers:test/makePet returned an error: the builtin provider does not implement callg
```

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant