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

[sdk/nodejs] Skip re-registrations of same package+version #6387

Merged
merged 2 commits into from
Feb 19, 2021

Conversation

lukehoban
Copy link
Member

@lukehoban lukehoban commented Feb 19, 2021

It is possible for the same version of the same provider SDK to be loaded multiple times in Node.js. In this case, we might legitimately get mutliple registrations of the same resource. It should not matter which we use, so we can just skip re-registering. De-serialized resources will always be instances of classes from the first registered package.

Example layout this addresses. Registrations of resources in package3 at the same verrsion.

  • node_modules
    • @pulumi/pulumi
    • package1
      • node_modules
        • package3
    • package2
      • node_modules
        • package3

Fixes #6258.

@@ -28,15 +28,14 @@ describe("runtime", () => {
describe("register", () => {
const tests = [
{ name: "wildcard version", version: undefined },
{ name: "blank version", version: "" },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a legal value at all - it happened to throw for an unrelated reason inside sameVersion - but that wasn't really what this test was trying to test.

Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

It is possible for the same version of the same provider SDK to be loaded multiple times in Node.js.  In this case, we might legitimately get mutliple registrations of the same resource.  It should not matter which we use, so we can just skip re-registering.  De-serialized resources will always be instances of classes from the first registered package.

Example layout this addresses.  Registrations of resources in `package3` at the same verrsion.

`node_modules`
  `@pulumi/pulumi`
  `package1`
    `node_modules`
      `package3`
  `package2`
    `node_modules`
      `package3`

Fixes #6258.
@lukehoban lukehoban merged commit f7397bb into master Feb 19, 2021
@pulumi-bot pulumi-bot deleted the lukehoban/6258 branch February 19, 2021 23:06
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.

Cannot re-register module aws:accessanalyzer/analyzer@3.27
3 participants