pulumi icon indicating copy to clipboard operation
pulumi copied to clipboard

Fatal error when doing pulumi login

Open JacekSmi opened this issue 2 years ago • 6 comments

What happened?

Fatal error appear when doing pulumi login

Expected Behavior

Should be logged in to state stored on Azure Blob

Steps to reproduce

  1. Set env variable AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_KEY
  2. Run pulumi login --cloud-url azblob://{container_name} Occur: "error: problem logging in: unable to open bucket azblob://{container_name}: failed azblob.NewSharedKeyCredential: decode account key: illegal base64 data at input byte 88"
  3. Set one more time env AZURE_STORAGE_KEY
  4. Run pulumi login --cloud-url azblob://{container_name}

Output of pulumi about

Pulumi Version: v3.78.1 Go Version: go1.20.7 Go Compiler: gc Architecture: amd64 Operating System: windows Panic: runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
runtime/debug.Stack()
        /opt/hostedtoolcache/go/1.20.7/x64/src/runtime/debug/stack.go:24 +0x65
main.panicHandler(0xc000831f47)
        /home/runner/work/pulumi/pulumi/pkg/cmd/pulumi/main.go:35 +0x47
panic({0x1f61d20, 0x3aa75c0})
        /opt/hostedtoolcache/go/1.20.7/x64/src/runtime/panic.go:884 +0x213
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob.appendToURLPath({0xc0003ae2d0?, 0x0?}, {0xc000123191, 0xc})
        /home/runner/go/pkg/mod/github.com/!azure/azure-sdk-for-go/sdk/storage/[email protected]/zc_service_client.go:138 +0x31
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob.(*ServiceClient).NewContainerClient(0xc0004bb9d0, {0xc000123191?, 0x0?})
        /home/runner/go/pkg/mod/github.com/!azure/azure-sdk-for-go/sdk/storage/[email protected]/zc_service_client.go:95 +0x3d
gocloud.dev/blob/azureblob.openBucket({0x0?, 0xc000831258?}, 0x16436d4?, {0xc000123191?, 0xc0003ae2d0?}, 0xc000be2ef0)
        /home/runner/go/pkg/mod/[email protected]/blob/azureblob/azureblob.go:449 +0x45
gocloud.dev/blob/azureblob.OpenBucket({0x28f6820?, 0xc00011e010?}, 0x2db180?, {0xc000123191?, 0xc000831278?}, 0xc000831268?)
        /home/runner/go/pkg/mod/[email protected]/blob/azureblob/azureblob.go:435 +0x28
gocloud.dev/blob/azureblob.(*URLOpener).OpenBucketURL(0xc000be2ea0, {0x28f6820, 0xc00011e010}, 0xc0007457a0)
        /home/runner/go/pkg/mod/[email protected]/blob/azureblob/azureblob.go:412 +0x9f
gocloud.dev/blob/azureblob.(*lazyOpener).OpenBucketURL(0xc0007ce150?, {0x28f6820?, 0xc00011e010?}, 0x3?)
        /home/runner/go/pkg/mod/[email protected]/blob/azureblob/azureblob.go:290 +0x78
gocloud.dev/blob.applyPrefixParam({0x28f6820, 0xc00011e010}, {0x28dcaa0, 0xc0007ce150}, 0xc0007457a0)
        /home/runner/go/pkg/mod/[email protected]/blob/blob.go:1375 +0x1ec
gocloud.dev/blob.(*URLMux).OpenBucket(0xc000123188?, {0x28f6820, 0xc00011e010}, {0xc000123188?, 0xc0007455f0?})
        /home/runner/go/pkg/mod/[email protected]/blob/blob.go:1350 +0x86
github.com/pulumi/pulumi/pkg/v3/backend/filestate.newLocalBackend({0x28f6820, 0xc00011e010}, {0x28ff880, 0xc0009f0750}, {0xc000123188, 0x15}, 0x2?, 0x1f97b20?)
        /home/runner/work/pulumi/pulumi/pkg/backend/filestate/backend.go:272 +0x1c5
github.com/pulumi/pulumi/pkg/v3/backend/filestate.New(...)
        /home/runner/work/pulumi/pulumi/pkg/backend/filestate/backend.go:223
main.nonInteractiveCurrentBackend({0x28f6820, 0xc00011e010}, 0x238d9a8?)
        /home/runner/work/pulumi/pulumi/pkg/cmd/pulumi/util.go:136 +0x11d
main.getSummaryAbout({0x28f6820, 0xc00011e010}, 0x0?, {0x0, 0x0})
        /home/runner/work/pulumi/pulumi/pkg/cmd/pulumi/about.go:178 +0x87a
main.newAboutCmd.func1(0x0?, {0x0?, 0x0?, 0x0?})
        /home/runner/work/pulumi/pulumi/pkg/cmd/pulumi/about.go:67 +0x71
github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil.RunFunc.func1(0x0?, {0x3b34fc8?, 0x0?, 0x0?})
        /home/runner/work/pulumi/pulumi/sdk/go/common/util/cmdutil/exit.go:96 +0x26
github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil.RunResultFunc.func1(0xc0009e4600?, {0x3b34fc8, 0x0, 0x0})
        /home/runner/work/pulumi/pulumi/sdk/go/common/util/cmdutil/exit.go:112 +0x4c
github.com/spf13/cobra.(*Command).execute(0xc0009e4600, {0x3b34fc8, 0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0xc000005800)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
main.main()
        /home/runner/work/pulumi/pulumi/pkg/cmd/pulumi/main.go:56 +0x65

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).

JacekSmi avatar Aug 16 '23 08:08 JacekSmi

Hello @JacekSmi thanks a lot for filing the issue 🙏 this indeed doesn't look right. In the first step to reproduce the issue, do you set the environment variable AZURE_STORAGE_KEY to a valid storage key? Because the first login attempt is erroring with failed azblob.NewSharedKeyCredential: decode account key: illegal base64 data at input byte 88

Will try to reproduce this locally on my machine and keep you posted of my findings

Zaid-Ajaj avatar Aug 23 '23 08:08 Zaid-Ajaj

Hi again @JacekSmi I was trying to reproduce the issue but I couldn't. I created a storage account in azure with proper permissions then I used in a pulumi project without issues. Can you please check that your storage account key is valid? The error shown suggests otherwise.

Zaid-Ajaj avatar Aug 23 '23 15:08 Zaid-Ajaj

Hi @Zaid-Ajaj for sure the key was valid, Unfortunately I'm not able to reproduce this also right now. I was coping key so this might be that I've copy this wrong, but I'm not sure.

JacekSmi avatar Aug 23 '23 17:08 JacekSmi

It is very likely that the copied key wasn't fully copied or maybe introduced an extra space and thus resulted in an invalid base64 key which the library could not decode.

Unfortunately I'm not able to reproduce this also right now.

Yeah same here, I am not sure what concrete actions we can here then.

Zaid-Ajaj avatar Aug 23 '23 19:08 Zaid-Ajaj

@Zaid-Ajaj thanks for explaination. I create this issue just because there was a message to do it after error appear.

If this was wrong copied key I suggest to add some validation or catch that error to not showing this general messege. If not we can close this item.

JacekSmi avatar Aug 23 '23 22:08 JacekSmi

I will keep this issue open for the time being because in any case, the CLI shouldn't fail with a panic. Thanks again for opening the issue, it helps us a lot knowing that there are edge cases we didn't account for 🙏

Zaid-Ajaj avatar Aug 23 '23 22:08 Zaid-Ajaj