I have a program that opens an .xlsx
file for parsing.
The file looks like this 15day_usage_backup/IDT(Boss) New Bill Logic - Cycle 07.01.21-07.15.21.xlsx
I use exc "github.com/360EntSecGroup-Skylar/excelize/v2"
library.
First of all, I download the file from an S3 bucket with
func (s awss3) GetFile(object string) (string, error) {
session, err := getSession()
if err != nil {
return "", err
}
file, err := os.Create(strings.Split(object, "/")[1])
if err != nil {
return "", err
}
_, err = manager.NewDownloader(session).Download(file, &s3.GetObjectInput{
Bucket: aws.String(cli.bucket),
Key: aws.String(object),
})
if err != nil {
return "", err
}
return file.Name(), nil
}
This downloads the file and places it in the current working directory.
I check the availability of the file with
if _, err := os.Stat(f); os.IsNotExist(err) {
return nil, fmt.Errorf("%s not found: %v", f, err)
}
My logs also show it’s present and about to be parsed like such
parsing IDT(Boss) New Bill Logic - Cycle 07.01.21-07.15.21.xlsx
I call
file, err := exc.OpenFile(f)
if err != nil {
logger.Error(ctx, fmt.Sprintf("error opening %s", f), err)
return nil, fmt.Errorf("error opening %s: %v", f, err)
}
which is a function from the external library.
Running in a container from my local machine, the file can be opened, but when I run from ECS, the task exits with no logs. It exits with no logs after I call this function from the external library.
I thought maybe because the file is too large, so it exits with no errors, but checking metrics shows that it has enough resources.
I have no clue to why the program exits while trying to open this file and also without returning logs.
Any idea will be helpful, thanks.