cycloidio / raws

[UNMAINTAINED] AWS Reader
MIT License
15 stars 0 forks source link

panic: when fetching list of bucket #50

Closed xlr-8 closed 5 years ago

xlr-8 commented 5 years ago

I used the command from Docker section: https://github.com/cycloidio/terracognita#docker

the program was working for a minute and then has crashed with the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x13c6b59]

goroutine 1 [running]:
github.com/cycloidio/raws.(*connector).ListBuckets(0xc0003bcdc0, 0x532a300, 0xc000038018, 0x0, 0xc000b4e708, 0xc00043a0d0, 0xc000ca7a40)
        /go/pkg/mod/github.com/cycloidio/raws@v1.0.0/list_buckets.go:34 +0x539
github.com/cycloidio/terracognita/aws.s3Buckets(0x532a300, 0xc000038018, 0xc000264bc0, 0x4b8f239, 0xd, 0x87e5810, 0x0, 0x0, 0x87e5810, 0x0, ...)
        /app/aws/resources.go:401 +0x6e
github.com/cycloidio/terracognita/aws.(*aws).Resources(0xc000264bc0, 0x532a300, 0xc000038018, 0x4b8f239, 0xd, 0xc000410be0, 0x87e5810, 0x0, 0x0, 0x0, ...)
        /app/aws/provider.go:66 +0xf6
github.com/cycloidio/terracognita/provider.Import(0x532a300, 0xc000038018, 0x5345740, 0xc000264bc0, 0x52d98c0, 0xc0004bc5c0, 0x0, 0x0, 0xc000410be0, 0xc000264bc0, ...)
        /app/provider/import.go:33 +0x2f6
github.com/cycloidio/terracognita/cmd.glob..func1(0x87b9220, 0xc0003d0dc0, 0x0, 0x5, 0x0, 0x0)
        /app/cmd/aws.go:66 +0x4d8
github.com/spf13/cobra.(*Command).execute(0x87b9220, 0xc0003d0d70, 0x5, 0x5, 0x87b9220, 0xc0003d0d70)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:762 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0x87b96e0, 0xc00043c500, 0xc0002a7f88, 0x40584f)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800
main.main()
        /app/main.go:11 +0x32

Moved from: https://github.com/cycloidio/terracognita/issues/29

xlr-8 commented 5 years ago

The logic need to be reviewed, as GetBucketLocation would return: https://github.com/aws/aws-sdk-go/blob/master/service/s3/api.go#L24385 which wouldn't match the region of the service.

Whereas GetBucketRegion seems to be the method to use, but it isn't a scoped method, so it makes the testing more annoying.