pulumi/sdk/nodejs/tests/runtime/langhost/cases
Julien 95e3d8fe26
Avoid calling invokes with dependencies on unknown resources (#18152)
Nodejs implementation of #18133

DependsOn for resources is an ordering constraint for register resource
calls. If a resource R1 depends on a resource R2, the register resource
call for R2 will happen after R1. This is ensured by awaiting the URN
for each resource dependency before calling register resource.

For invokes, this causes a problem when running under preview. During
preview, register resource immediately returns with the URN, however
this does not tell us if the resource "exists".

Instead of waiting for the dependency's URN, we wait for the ID. This
tells us that whether a physical resource exists (if the state is in
sync), and we can avoid calling the invoke when it is unknown.

The following example fails without this change:
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const config = new pulumi.Config()
const billingAccountId = config.require("billing-account")

const billingAccount = gcp.organizations.getBillingAccountOutput({
    billingAccount: billingAccountId
})

const project = new gcp.organizations.Project("project", {
    billingAccount: billingAccount.id,
    name: "project-nodejs",
    autoCreateNetwork: false,
    deletionPolicy: "DELETE",
})

export const zones = gcp.compute.getZonesOutput({
    project: project.projectId,
    region: "us-central1"
}, {
    dependsOn: [project],
})
```
2025-01-07 09:55:27 +00:00
..
000.empty Apply autoformat 2023-04-28 18:27:10 -04:00
001.one_resource Apply autoformat 2023-04-28 18:27:10 -04:00
002.ten_resources Apply autoformat 2023-04-28 18:27:10 -04:00
003.one_complex_resource Apply autoformat 2023-04-28 18:27:10 -04:00
004.ten_complex_resources Apply autoformat 2023-04-28 18:27:10 -04:00
005.resource_thens Apply autoformat 2023-04-28 18:27:10 -04:00
006.asset Apply autoformat 2023-04-28 18:27:10 -04:00
007.promises_io Apply autoformat 2023-04-28 18:27:10 -04:00
008.ten_depends_on_resources Apply autoformat 2023-04-28 18:27:10 -04:00
009.invoke Apply autoformat 2023-04-28 18:27:10 -04:00
010.runtime_settings Replace equal and deepEqual with strictEqual and deepStrictEqual (#5607) 2020-10-21 10:21:47 -07:00
011.unhandled_error Add a test. 2017-12-13 17:30:43 -08:00
012.assets_archive Apply autoformat 2023-04-28 18:27:10 -04:00
013.unhandled_promise_rejection Apply autoformat 2023-04-28 18:27:10 -04:00
014.read_resource NodeJS now accepts unknown resource IDs for read resource (#14137) 2023-10-19 16:00:10 +00:00
015.runtime_sxs set mock monitor in global store (#17769) 2024-11-21 09:39:37 +00:00
016.promise_leak Improve the promise leak experience (#1374) 2018-05-17 15:32:39 -07:00
017.parent_defaults Apply autoformat 2023-04-28 18:27:10 -04:00
018.logging Fix an issue with NodeJS host logging (#1819) 2018-08-24 16:50:09 -07:00
019.stack_exports Incorporate PR feedback 2018-09-02 12:15:58 -07:00
020.property_dependencies Apply autoformat 2023-04-28 18:27:10 -04:00
021.parent_child_dependencies Apply autoformat 2023-04-28 18:27:10 -04:00
022.parent_child_dependencies_2 Apply autoformat 2023-04-28 18:27:10 -04:00
023.parent_child_dependencies_3 Apply autoformat 2023-04-28 18:27:10 -04:00
024.parent_child_dependencies_4 Apply autoformat 2023-04-28 18:27:10 -04:00
025.parent_child_dependencies_5 Apply autoformat 2023-04-28 18:27:10 -04:00
026.parent_child_dependencies_6 Apply autoformat 2023-04-28 18:27:10 -04:00
027.parent_child_dependencies_7 Apply autoformat 2023-04-28 18:27:10 -04:00
028.parent_child_dependencies_8 Apply autoformat 2023-04-28 18:27:10 -04:00
029.parent_child_dependencies_9 Apply autoformat 2023-04-28 18:27:10 -04:00
030.import_resource Apply autoformat 2023-04-28 18:27:10 -04:00
040.run_error Use result.Result in more places. (#2568) 2019-03-19 16:21:50 -07:00
041.component_opt_single_provider Apply autoformat 2023-04-28 18:27:10 -04:00
042.component_opt_providers_array Apply autoformat 2023-04-28 18:27:10 -04:00
043.depends_on_non_resource Implement `dependsOn` for invokes in the NodeJS SDK (#16560) 2024-07-03 14:47:59 +00:00
044.versions Add NodeJS test for parameterized providers #2 (#16901) 2024-08-09 08:34:29 +00:00
045.ignore_changes Add an ignoreChanges resource option (#2657) 2019-04-22 13:54:48 -07:00
046.recursive_stack_exports Properly handle recursive outputs without penalizing non-recursive ones. (#3206) 2019-09-10 12:29:52 -07:00
047.exported_function Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
048.exported_promise_function Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
049.exported_async_function Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
050.resource_creation_in_function Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
051.resource_creation_in_function_with_result Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
052.resource_creation_in_async_function_with_result Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
060.provider_invokes Apply autoformat 2023-04-28 18:27:10 -04:00
061.provider_in_parent_invokes Apply autoformat 2023-04-28 18:27:10 -04:00
062.providerref_invokes Replace equal and deepEqual with strictEqual and deepStrictEqual (#5607) 2020-10-21 10:21:47 -07:00
063.providerref_in_parent_invokes Apply autoformat 2023-04-28 18:27:10 -04:00
064.async_components Apply autoformat 2023-04-28 18:27:10 -04:00
065.large_resource Apply autoformat 2023-04-28 18:27:10 -04:00
066.replace_on_changes Add `replaceOnChanges` resource option (#7226) 2021-07-01 13:32:08 -06:00
067.native_es_module Replace Rome with Biome in the NodeJS SDK (#16456) 2024-06-24 11:14:56 +00:00
068.remote_component_providers Replace Rome with Biome in the NodeJS SDK (#16456) 2024-06-24 11:14:56 +00:00
069.ambiguous_entrypoints Apply autoformat 2023-04-28 18:27:10 -04:00
070.unusual_alias_names Apply autoformat 2023-04-28 18:27:10 -04:00
071.large_alias_counts Apply autoformat 2023-04-28 18:27:10 -04:00
072.large_alias_lineage_chains Apply autoformat 2023-04-28 18:27:10 -04:00
073.component_dependencies Apply autoformat 2023-04-28 18:27:10 -04:00
074.source_position [sdk/*] Add support for resource source positions 2023-07-13 16:46:04 -07:00
075.invoke_output_depends_on [Node.js] Allow specifiying dependencies for output invokes (#17632) 2024-11-20 16:03:11 +00:00
076.invoke_output_depends_on_non_resource [Node.js] Allow specifiying dependencies for output invokes (#17632) 2024-11-20 16:03:11 +00:00
077.invoke_output_depends_on_unknown_component Avoid calling invokes with dependencies on unknown resources (#18152) 2025-01-07 09:55:27 +00:00