devspace icon indicating copy to clipboard operation
devspace copied to clipboard

devspace init, image repository causes panic

Open SamuelColacchia opened this issue 5 years ago • 4 comments

What happened? cli crashed, panic: runtime error: invalid memory address or nil pointer dereference

What did you expect to happen instead? Expected minimal devspace.yml to be generated

How can we reproduce the bug? (as minimally and precisely as possible) Follow the getting started guide at devspace init selecting any one options except "Always skip image push...." results in the following error.

? How do you want to initialize this project?
 Use the Dockerfile in ./Dockerfile

? Which registry do you want to use for storing your Docker images?
 Use hub.docker.com
[wait] | Checking registry authentication (0s)panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x58 pc=0x1654bb8]

goroutine 1 [running]:
github.com/devspace-cloud/devspace/pkg/devspace/docker.(*client).Login(0xc000f65450, 0x2194c12, 0xe, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2b, 0x0, ...)
        /Users/runner/runners/2.169.0/work/devspace/devspace/pkg/devspace/docker/auth.go:43 +0xc8
github.com/devspace-cloud/devspace/pkg/devspace/configure.(*manager).getRegistryURL(0xc0006e5e90, 0x26489e0, 0xc000f65450, 0x212bcf2, 0x7, 0xc00112da28, 0x5, 0x0, 0x0, 0x0)
        /Users/runner/runners/2.169.0/work/devspace/devspace/pkg/devspace/configure/image.go:288 +0x52f
github.com/devspace-cloud/devspace/pkg/devspace/configure.(*manager).newImageConfigFromDockerfile(0xc0006e5e90, 0xc000f3f300, 0x10, 0x2170aa8, 0xc, 0x0, 0x0, 0xc00112db00, 0xa9e86a, 0xc000f2ca70)
        /Users/runner/runners/2.169.0/work/devspace/devspace/pkg/devspace/configure/image.go:103 +0x2a2
github.com/devspace-cloud/devspace/pkg/devspace/configure.(*manager).NewDockerfileComponentDeployment(0xc0006e5e90, 0xc000f3d530, 0xc000f21b80, 0x11, 0x0, 0x0, 0x2170aa8, 0xc, 0x0, 0x0, ...)
        /Users/runner/runners/2.169.0/work/devspace/devspace/pkg/devspace/configure/deployment.go:26 +0xea
github.com/devspace-cloud/devspace/cmd.(*InitCmd).Run(0xc0000d21e0, 0x2664400, 0x3a401d0, 0xc000e7d900, 0x3a401d0, 0x0, 0x0, 0x0, 0x0)
        /Users/runner/runners/2.169.0/work/devspace/devspace/cmd/init.go:239 +0xa1a
github.com/devspace-cloud/devspace/cmd.NewInitCmd.func1(0xc000e7d900, 0x3a401d0, 0x0, 0x0, 0x0, 0x0)
        /Users/runner/runners/2.169.0/work/devspace/devspace/cmd/init.go:80 +0x6b
github.com/spf13/cobra.(*Command).execute(0xc000e7d900, 0x3a401d0, 0x0, 0x0, 0xc000e7d900, 0x3a401d0)
        /Users/runner/runners/2.169.0/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:826 +0x467
github.com/spf13/cobra.(*Command).ExecuteC(0xc00055cc80, 0x3a401d0, 0xc00055cc80, 0xc00079bf90)
        /Users/runner/runners/2.169.0/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:914 +0x302
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/runner/runners/2.169.0/work/devspace/devspace/vendor/github.com/spf13/cobra/command.go:864
github.com/devspace-cloud/devspace/cmd.Execute()
        /Users/runner/runners/2.169.0/work/devspace/devspace/cmd/root.go:99 +0xb5
main.main()
        /Users/runner/runners/2.169.0/work/devspace/devspace/main.go:17 +0x45

Local Environment:

  • DevSpace Version: 4.12.1
  • Operating System: windows
  • Docker 19.03.8
  • Powershell 7.0.0

Anything else we need to know? I currently have not setup any authentication for dockerhub.

/kind bug

SamuelColacchia avatar Apr 21 '20 00:04 SamuelColacchia

@SamuelColacchia thanks for reporting this issue! I'll fix this right away!

FabianKramm avatar Apr 21 '20 07:04 FabianKramm

@FabianKramm I was doing some more testing to try and determine what exactly was causing this. The issue originated with my ~/.docker/config.json some how "credsStore":"desktop" which caused docker to error which then caused devspace init to panic. Here is the docker error I had. Alternatively ensuring that the system path variables are setup correctly fixes it to. In my case for some reason a few of my path variables where miss-configured.

docker.credentials.errors.StoreError: 
Credentials store docker-credential-desktop exited with "error getting credentials - err:
exec: "docker-credential-wincred.exe": executable file not found in %PATH%, out: ``".

Once i applied either of these fixes the CLI worked as intended.

Potential Solution for devspace: Since this error is caused by incorrect configurations maybe add some error handling for issues like this.

SamuelColacchia avatar Apr 21 '20 22:04 SamuelColacchia

@SamuelColacchia thanks for investigating! With v4.12.2 devspace shouldn't throw a nil pointer exception anymore, however you are correct we could still improve the error handling in cases of wrong docker configuration, so I'll leave this issue open for now

FabianKramm avatar Apr 22 '20 11:04 FabianKramm

Since this issue is about nil pointer exception and that's fixed, I'm closing this issue. If @SamuelColacchia still wants an improvement, please feel free to open a new issue for that enhancement request.

deniseschannon avatar Apr 30 '24 18:04 deniseschannon