0650e8bbbb
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 |
||
---|---|---|
.. | ||
asset | ||
automation | ||
cmd | ||
dist | ||
dynamic | ||
iterable | ||
log | ||
npm | ||
proto | ||
provider | ||
queryable | ||
runtime | ||
tests | ||
tests_with_mocks | ||
.eslintrc.js | ||
.gitignore | ||
Makefile | ||
README.md | ||
config.ts | ||
errors.ts | ||
index.ts | ||
invoke.ts | ||
metadata.ts | ||
output.ts | ||
package.json | ||
resource.ts | ||
rome.json | ||
stackReference.ts | ||
tsconfig.json | ||
tsutils.ts | ||
utils.ts | ||
version.ts | ||
yarn.lock |
README.md
Pulumi Node.js SDK
The Pulumi Node.js SDK lets you write cloud programs in JavaScript.
Installation
Using npm:
$ npm install --save @pulumi/pulumi
Using yarn:
$ yarn add @pulumi/pulumi
This SDK is meant for use with the Pulumi CLI. Visit Pulumi's Download & Install to install the CLI.
Building and Testing
For anybody who wants to build from source, here is how you do it.
Prerequisites
This SDK uses Node.js and we support any of the Current, Active and Maintenance LTS versions. We support both NPM and Yarn for package management.
At the moment, we only support building on macOS and Linux, where standard GNU tools like make
are available.
Make Targets
To build the SDK, simply run make
from the root directory (where this README
lives, at sdk/nodejs/
from the repo's
root). This will build the code, run tests, and install the package and its supporting artifacts.
At the moment, for local development, we install everything into $HOME/.dev-pulumi
. You will want this on your $PATH
.
The tests will verify that everything works, but feel free to try running pulumi preview
and/or pulumi up
from
the examples/minimal/
directory. Remember to run tsc
first, since pulumi
expects JavaScript, not TypeScript.