question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pulumi.Aws.Invokes.GetCallerIdentity throws System.NullReferenceException

See original GitHub issue
  • Language: dotnet

Description of issue

await Pulumi.Aws.Invokes.GetCallerIdentity(); always throws exception.

error: Running program 'D:\git\infra\pulumi\sandbox\bin\Debug\netcoreapp3.0\Infra.dll' failed with an unhandled exception:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Pulumi.Deployment.InvokeAsync[T](String token, ResourceArgs args, InvokeOptions options, Boolean convertResult)
       at Program.<>c.<<Main>b__0_0>d.MoveNext() in D:\work\infra\pulumi\sandbox\Program.cs:line 17
    --- End of stack trace from previous location where exception was thrown ---
       at Pulumi.Stack.RunInitAsync(Func`1 init)
       at Pulumi.Output`1.GetValueAsync()
       at Pulumi.Deployment.RegisterResourceOutputsAsync(Resource resource, Output`1 outputs)
       at Pulumi.Deployment.Runner.WhileRunningAsync()

Minimum reproduce

  • run pulumi new aws-csharp
  • add await Pulumi.Aws.Invokes.GetCallerIdentity(); to Program.cs.
  • run pulumi up
  • throw exception on preview.
using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi;

class Program
{
    static Task<int> Main()
    {
        return Deployment.RunAsync(async () =>
        {
            await Pulumi.Aws.Invokes.GetCallerIdentity();
        });
    }
}

It also happens even if I explicitly made provider for profile or AccessKey.

            var provider = new Pulumi.Aws.Provider("sandbox", new Pulumi.Aws.ProviderArgs
            {
                Profile = "my-provider",
                Region = "ap-northeast-1",
            });
            await Pulumi.Aws.Invokes.GetCallerIdentity(new InvokeOptions{Provider = provider,});
            var provider = new Pulumi.Aws.Provider("sandbox", new Pulumi.Aws.ProviderArgs
            {
                AccessKey = "INPUT_ACCESSKEY",
                SecretKey = "INPUT_SECRETKEY",
                Region = "ap-northeast-1",
            });
            await Pulumi.Aws.Invokes.GetCallerIdentity(new InvokeOptions{Provider = provider,});

Expected behavior

get GetCallerIdentityResult.

Actual behavior

throws exception.

Version

$ pulumi version
v1.5.1
$ pulumi plugin ls
NAME  KIND      VERSION                           SIZE    INSTALLED      LAST USED
aws   resource  1.10.0                            185 MB  2 minutes ago  2 minutes ago

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mikhailshilkovcommented, Nov 21, 2019

Try adding <PackageReference Include="Pulumi" Version="1.6.0-preview" />

1reaction
mikhailshilkovcommented, Nov 20, 2019

@pgavlin Yes, should be fixed with Pulumi Nuget 1.5.2-preview

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws.getCallerIdentity - Pulumi
Documentation for the aws.getCallerIdentity function with examples, input properties, output properties, and supporting types.
Read more >
aws.lambda.Invocation - Pulumi
Use this resource to invoke a lambda function. The lambda function is invoked with the RequestResponse invocation type. NOTE: This resource only ...
Read more >
aws.lambda.Function - Pulumi
Documentation for the aws.lambda.Function resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
aws.lambda.Permission - Pulumi
using System.Collections.Generic; using System.Text.Json; using Pulumi; using Aws = Pulumi.Aws; return await Deployment.RunAsync(() => { var defaultTopic ...
Read more >
aws.lambda.getFunction - Pulumi
ARN to be used for invoking Lambda Function from API Gateway. kmsKeyArn string. ARN for the KMS encryption key. lastModified string.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found