Skip to content

[Bug] Timeout Error is thrown when importing records that contain large attachments #525

Open
@hung-cybo

Description

Summary

A timeout error is thrown when importing records that contain large attachments.

[2023-10-13T09:07:39.468Z] INFO: Starting to import records...
[2023-10-13T09:08:40.451Z] INFO: Imported 0 of 1 records successfully
[2023-10-13T09:08:40.452Z] ERROR: Failed to add all records.
[2023-10-13T09:08:40.452Z] ERROR: No records are processed successfully.
[2023-10-13T09:08:40.452Z] ERROR: [ECONNABORTED] timeout of 60000ms exceeded
[2023-10-13T09:08:40.452Z] ERROR: The cli-kintone aborted due to a network error.
[2023-10-13T09:08:40.452Z] ERROR: Please check your network connection.

Root cause of the issue

The follow-redirects library used by the Axios has a problem. This library provides http(s) requests with the following redirects. The Axios uses it internally if the client requires the following redirects here.

The 'follow-redirects' provides its own implementation of setTimeout(). This implementation NEVER considers in-progress requests. The request produced by follow-redirects emits a 'timeout' event if the request is still in progress. The reason why we can download huge attachment files is the time is canceled when the client receives a response from the server.

The related issues on follow-redirects:

Target Version

v1.10.0

Reproduction

$ cat records.csv
"Attachment"
"Attachment-1/1gb"

$ ls -l attachments/Attachment-1/1gb
-rw-r--r-- 1 shinya-u shinya-u 1073741824 Sep 14 05:09 attachments/Attachment-1/1gb

$ cli-kintone record import --base-url https://****kintone.com --app 9 --attachments-dir attachments --file-path records.csv

Expected Behavior

Should importing successfully

Actual Behavior

A timeout error is thrown.

[2023-09-14T05:09:29.317Z] INFO: Starting to import records...
[2023-09-14T05:10:29.905Z] INFO: Imported 0 of 1 records successfully
[2023-09-14T05:10:29.906Z] ERROR: Failed to add all records.
[2023-09-14T05:10:29.906Z] ERROR: No records are processed successfully.
[2023-09-14T05:10:29.906Z] ERROR: [ECONNABORTED] timeout of 60000ms exceeded
[2023-09-14T05:10:29.906Z] ERROR: The cli-kintone aborted due to a network error.
[2023-09-14T05:10:29.906Z] ERROR: Please check your network connection.

Operation System (if relevant)

No response

Shell (if relevant)

No response

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions