f5b117505c
This change updates the engine to detect if a `RegisterResource` request is coming from an older Node.js SDK that is using incorrect alias specs and, if so, transforms the aliases to be correct. This allows us to maintain compatibility for users who have upgraded their CLI but are still using an older version of the Node.js SDK with incorrect alias specs. We detect if the request is from a Node.js SDK by looking at the gRPC request's metadata headers, specifically looking at the "pulumi-runtime" and "user-agent" headers. First, if the request has a "pulumi-runtime" header with a value of "nodejs", we know it's coming from the Node.js plugin. The Node.js language plugin proxies gRPC calls from the Node.js SDK to the resource monitor and the proxy now sets the "pulumi-runtime" header to "nodejs" for `RegisterResource` calls. Second, if the request has a "user-agent" header that starts with "grpc-node-js/", we know it's coming from the Node.js SDK. This is the case for inline programs in the automation API, which connects directly to the resource monitor, rather than going through the language plugin's proxy. We can't just look at "user-agent", because in the proxy case it will have a Go-specific "user-agent". Updated Node.js SDKs set a new `aliasSpecs` field on the `RegisterResource` request, which indicates that the alias specs are correct, and no transforms are needed. |
||
---|---|---|
.. | ||
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.