pulumi-azure-native: azure_native.storage.listStorageAccountKeys throws error even with valid credentials

What happened?

After updating Pulumi and Azure Native versions to resolve a bug with Microsoft.TimeSeriesInsights (using the solution provided here) I have encountered another bug where listStorageAccountKeys seems to be throwing an error:

error: Running program '*\*\iac\azure/' failed with an unhandled exception:
    <ref *1> Error: invocation of azure-native:storage:listStorageAccountKeys returned an error: error reading from server: read tcp 127.0.0.1:57473->127.0.0.1:57471: wsarecv: An existing connection was forcibly closed by the remote host.
        at Object.callback (*\*\iac\node_modules\@pulumi\runtime\invoke.ts:261:37)
        at Object.onReceiveStatus (*\*\iac\node_modules\@grpc\grpc-js\src\client.ts:360:26)
        at Object.onReceiveStatus (*\*\iac\node_modules\@grpc\grpc-js\src\client-interceptors.ts:458:34)
        at Object.onReceiveStatus (*\*\iac\node_modules\@grpc\grpc-js\src\client-interceptors.ts:419:48)
        at *\*\iac\node_modules\@grpc\grpc-js\src\resolving-call.ts:163:24
        at processTicksAndRejections (node:internal/process/task_queues:77:11) {
      promise: Promise { <rejected> [Circular *1] }
    }

We upgraded these versions:

"@azure/arm-appcontainers": "^1.1.2", -> "^2.1.0"
"@azure/identity": "^3.3.0", -> "^4.4.1"
"@pulumi/azure": "^5.49.0", -> "^6.0.0"
"@pulumi/azure-native": "^1.104.0", -> "^2.63.0"
"@pulumi/azuread": "^5.40.0", -> "^5.53.4"
"@pulumi/pulumi": "^3.115.2", -> "^3.134.0"

Example

The source of the error seems to come from these lines:

const keys = await azure_native.storage.listStorageAccountKeys({
		accountName: storage_account_name,
		resourceGroupName: RESOURCE_GROUP_NAME
	});
	const firstKeyIndex = 0;
	const storage_account_access_key = keys.keys[firstKeyIndex].value;`

Output of `pulumi about

CLI
Version      3.115.0
Go Version   go1.22.2
Go Compiler  gc

Plugins
KIND      NAME          VERSION
resource  azure         6.0.0
resource  azure-native  2.63.0
resource  azuread       5.53.4
language  nodejs        unknown
resource  random        4.13.2

Host
OS       Microsoft Windows 11 Pro
Version  10.0.22631 Build 22631
Arch     x86_64

This project is written in nodejs: executable='C:\Program Files\nodejs\node.exe' version='v18.10.0'

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you’ve opened one already).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Yes I would consider this issue resolved, I didn’t realize I needed to mark it. Thanks for the help @thomas11 !

This is due to Pulumi’s handling of outputs. To make it easier, however, there’s also the output version of the function, listStorageAccountKeysOutput. It takes output arguments, so you can pass resourceGroup.name, storageAccount.name directly.

That fixed the index out of range error!