For temporarily sending a file to a machine, I do echo ... | fly sftp shell ...
. Unfortunately, it stopped working:
$ echo "put myfile /tmp/myfile" | fly sftp shell --address fdaa:2:d990:a7b:15d:a295:b10b:2 --app myapp
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x55d2adc80e7e]
goroutine 1 [running]:
github.com/superfly/fly-go.(*Machine).IsReleaseCommandMachine(...)
github.com/superfly/fly-go@v0.1.22-0.20240802153530-1487eea07345/machine_types.go:232
github.com/superfly/fly-go/flaps.(*Client).ListActive.func1(0xc0005a1a40)
github.com/superfly/fly-go@v0.1.22-0.20240802153530-1487eea07345/flaps/flaps_machines.go:214 +0xde
slices.IndexFunc[...](...)
slices/slices.go:107
slices.DeleteFunc[...]({0xc000a54400?, 0x3b, 0x40}, 0x55d2b0100360)
slices/slices.go:235 +0x62
github.com/superfly/fly-go/flaps.(*Client).ListActive(0xc00120c4c0, {0x55d2b012dc28, 0xc000bdd080})
github.com/superfly/fly-go@v0.1.22-0.20240802153530-1487eea07345/flaps/flaps_machines.go:213 +0x13b
github.com/superfly/flyctl/internal/command/ssh.addrForMachines({0x55d2b012dc28, 0xc000bdd080}, 0xc000bfc3d0, 0x0)
github.com/superfly/flyctl/internal/command/ssh/console.go:234 +0xfc
github.com/superfly/flyctl/internal/command/ssh.lookupAddress({0x55d2b012dc28, 0xc000bdd080}, 0xc0012b63c0, {0x55d2b01272c0, 0xc00120c3c0}, 0xc000bfc3d0, 0x0?)
github.com/superfly/flyctl/internal/command/ssh/console.go:83 +0x55
github.com/superfly/flyctl/internal/command/ssh.newSFTPConnection({0x55d2b012dc28, 0xc000bdd080})
github.com/superfly/flyctl/internal/command/ssh/sftp.go:103 +0x1d4
github.com/superfly/flyctl/internal/command/ssh.runShell({0x55d2b012dc28?, 0xc000bdd080?})
github.com/superfly/flyctl/internal/command/ssh/sftp.go:530 +0x4a
github.com/superfly/flyctl/internal/command/ssh.newSFTPShell.New.newRunE.func1(0xc000b06f08, {0x55d2af07266d?, 0x4?, 0x55d2af0724c1?})
github.com/superfly/flyctl/internal/command/command.go:140 +0x1d9
github.com/spf13/cobra.(*Command).execute(0xc000b06f08, {0xc000ad9340, 0x4, 0x4})
github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0006c2608)
github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/superfly/flyctl/internal/cli.Run({0x55d2b012ddb0?, 0xc000997f00?}, 0xc00013c960, {0xc000050160, 0x6, 0x6})
github.com/superfly/flyctl/internal/cli/cli.go:94 +0x69a
main.run()
github.com/superfly/flyctl/main.go:47 +0x156
main.main()
github.com/superfly/flyctl/main.go:26 +0x18
$ echo "put myfile /tmp/myfile" | fly ssh sftp shell --address fdaa:2:d990:a7b:15d:a295:b10b:2 --app myapp
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x56281ee8de7e]
goroutine 1 [running]:
github.com/superfly/fly-go.(*Machine).IsReleaseCommandMachine(...)
github.com/superfly/fly-go@v0.1.22-0.20240802153530-1487eea07345/machine_types.go:232
github.com/superfly/fly-go/flaps.(*Client).ListActive.func1(0xc00037eb40)
github.com/superfly/fly-go@v0.1.22-0.20240802153530-1487eea07345/flaps/flaps_machines.go:214 +0xde
slices.IndexFunc[...](...)
slices/slices.go:107
slices.DeleteFunc[...]({0xc0008dc600?, 0x3b, 0x40}, 0x56282130d360)
slices/slices.go:235 +0x62
github.com/superfly/fly-go/flaps.(*Client).ListActive(0xc0011f2f40, {0x56282133ac28, 0xc000bbe150})
github.com/superfly/fly-go@v0.1.22-0.20240802153530-1487eea07345/flaps/flaps_machines.go:213 +0x13b
github.com/superfly/flyctl/internal/command/ssh.addrForMachines({0x56282133ac28, 0xc000bbe150}, 0xc000bc03d0, 0x0)
github.com/superfly/flyctl/internal/command/ssh/console.go:234 +0xfc
github.com/superfly/flyctl/internal/command/ssh.lookupAddress({0x56282133ac28, 0xc000bbe150}, 0xc001257d60, {0x5628213342c0, 0xc0012a2100}, 0xc000bc03d0, 0x0?)
github.com/superfly/flyctl/internal/command/ssh/console.go:83 +0x55
github.com/superfly/flyctl/internal/command/ssh.newSFTPConnection({0x56282133ac28, 0xc000bbe150})
github.com/superfly/flyctl/internal/command/ssh/sftp.go:103 +0x1d4
github.com/superfly/flyctl/internal/command/ssh.runShell({0x56282133ac28?, 0xc000bbe150?})
github.com/superfly/flyctl/internal/command/ssh/sftp.go:530 +0x4a
github.com/superfly/flyctl/internal/command/ssh.newSFTPShell.New.newRunE.func1(0xc000ac5b08, {0x56282027f66d?, 0x4?, 0x56282027f4c1?})
github.com/superfly/flyctl/internal/command/command.go:140 +0x1d9
github.com/spf13/cobra.(*Command).execute(0xc000ac5b08, {0xc000a5f700, 0x4, 0x4})
github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0008a2008)
github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
github.com/spf13/cobra@v1.8.1/command.go:1050
github.com/superfly/flyctl/internal/cli.Run({0x56282133adb0?, 0xc0007efe40?}, 0xc00088a000, {0xc000050090, 0x7, 0x7})
github.com/superfly/flyctl/internal/cli/cli.go:94 +0x69a
main.run()
github.com/superfly/flyctl/main.go:47 +0x156
main.main()
github.com/superfly/flyctl/main.go:26 +0x18
It used to work but now it is broken.
By the way, is there a more elegant way to send a small and temporary file to a running machine?