pulumi/changelog/pending
Justin Van Patten 0650e8bbbb
[sdk/nodejs] Fix provider for resource methods (#13796)
The `Resource` class in the Node.js SDK has the following internal
property:

```typescript
/** @internal */
readonly __prov?: ProviderResource;
```

When a resource is created, the provider specified for the resource is
stored in this property. If it is set, it is passed along in the `Call`
request when a method is called on the resource.

Prior to #13282, the property was only set for custom resources in
`Resource`'s constructor:

```typescript
this.__prov = custom ? opts.provider : undefined;
```

With #13282, it was changed to also store the value for remote
components:

```diff
- this.__prov = custom ? opts.provider : undefined;
+ this.__prov = custom || remote ? opts.provider : undefined;
```

This regressed the behavior when calling a method on a remote component
that had an explicit provider that wasn't the component provider, but
some other provider (e.g. AWS provider) specified as:

```typescript
const component = new MyRemoteComponent("comp", {
}, { provider: awsProvider });
```

The `awsProvider` was being stored in `Resource.__prov`, and when making
the method call on the resource, it would try to invoke `Call` on the
AWS provider, rather than calling the remote component provider's
`Call`, which resulted in an error.

Note that specifying the AWS provider using the more verbose `providers:
[awsProvider]` works around the issue.

The fix is to only set `__prov` if the provider's package is the same as
the resource's package. Otherwise, don't set it, because the user is
specifying a provider with the `provider: awsProvider` syntax as
shorthand for `providers: [awsProvider]`.

Fixes #13777
2023-08-30 14:49:53 +00:00
..
20230717--sdk-go--add-sdk-go-pulumix-package.yaml sdk/go: Add pulumix subpackage (#13509) 2023-08-28 15:38:23 +00:00
20230717--sdkgen-go--generate-types-that-are-compatible-with-pulumix.yaml codegen/go: Implement pux.Input[T] for generated types (#13510) 2023-08-28 16:42:37 +00:00
20230726--sdk-go--built-in-pulumi-types-all-satisfy-pulumix-input-t.yaml sdk/go: Add pulumix subpackage (#13509) 2023-08-28 15:38:23 +00:00
20230825--cli-new--fix-regression-where-pulumi-new-s-org-project-stack-would-fail-if-the-project-already-exists.yaml Fix `pulumi new` erroring when the project already exists. (#13786) 2023-08-29 18:01:51 +00:00
20230825--sdk-go--add-cmdutil-terminateprocessgroup-to-terminate-processes-gracefully.yaml feat(cmdutil): TerminateProcessGroup for graceful termination (#13792) 2023-08-27 22:05:44 +00:00
20230826--cli-plugin--give-plugins-a-chance-to-clean-up-before-they-exit.yaml resource/plugin: Shut down plugins gracefully (#13795) 2023-08-29 12:02:54 +00:00
20230826--sdk-go--deprecate-cmdutil-killchildren-please-use-cmdutil-terminateprocessgroup-instead.yaml resource/plugin: Shut down plugins gracefully (#13795) 2023-08-29 12:02:54 +00:00
20230826--sdk-nodejs--fix-provider-used-for-resource-methods.yaml [sdk/nodejs] Fix provider for resource methods (#13796) 2023-08-30 14:49:53 +00:00
20230827--sdkgen-nodejs-python--nodejs-and-python-packages-no-longer-running-plugin-install-scripts-on-package-install.yaml Remove NodeJS and Python install scripts (#13800) 2023-08-30 08:05:34 +00:00
20230828--sdk-go-nodejs-python--language-plugins-clean-up-resources-and-exit-cleanly-with-status-code-zero.yaml plugin(go, node, py): Exit cleanly on interrupt (#13809) 2023-08-29 15:42:31 +00:00