aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

[s3] EPROTO error while PUTting a file

Open ffxsam opened this issue 2 years ago • 4 comments

Describe the bug

This bug occurs occasionally, while using PutObjectCommand to write a file to S3.

Your environment

SDK version number

@aws-sdk/[email protected]

Is the issue in the browser/Node.js/ReactNative?

Node.js

Details of the browser/Node.js/ReactNative version

14.18.1

Steps to reproduce

???

Observed behavior

Randomly, I get an EPROTO error while writing a file to S3: https://sentry.io/share/issue/d8c93d01f7a2438b82c63c610eb541f3/

Expected behavior

I would expect S3 PUT operations to work properly.

I realize this isn't much info to go on, but hopefully someone can help me troubleshoot this and figure out where the problem is occurring.

ffxsam avatar Jan 20 '22 16:01 ffxsam

I'm seeing the same issue but with the CopyObjectCommand.

matootie avatar Feb 20 '22 01:02 matootie

The same problem occurs when sending a GetObjectCommandInput object, while the full error output is the following

{
    "errorType": "Error",
    "errorMessage": "write EPROTO",
    "code": "EPROTO",
    "errno": -71,
    "syscall": "write",
    "$metadata": {
        "attempts": 1,
        "totalRetryDelay": 0
    },
    "stack": [
        "Error: write EPROTO",
        "    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16)"
    ]
}

Code execution: AWS lambda provisioned with serverless using Node 14 Client: @aws-sdk/client-s3@^3.53.1

florian-netlight avatar Mar 09 '22 06:03 florian-netlight

I've saw a similar issue, on @aws-sdk/client-ecs: "^3.52.0" package for node.js (14.15.4), running on AWS Fargate ECS task. The workaround was to update the Config object, set the maxRetries and the retryDelayOptions. This caused a new API call to be executed shortly after the failed, without aborting the code. Consider that it may be a good practice to update the httpOptions timeout value, as well.

ttres avatar Apr 21 '22 05:04 ttres

Hi, is there an update to this? We are running into the same issue. We updated our code from AWS-sdk v2

await awsS3.putObject({
    Bucket: bucketName,
    Key: `email/${newEmail.to}/${timestamp}`,
    Body: JSON.stringify(newEmail),
    ContentType: 'application/json; charset=utf-8',
  }).promise();

to v3

await awsS3.send(new PutObjectCommand({
    Bucket: bucketName,
    Key: `email/${newEmail.to}/${timestamp}`,
    Body: JSON.stringify(newEmail),
    ContentType: 'application/json; charset=utf-8',
  }));

And started running into this problem. Here is the error we are getting

ERROR   Unhandled Promise Rejection     
{
    "errorType": "Runtime.UnhandledPromiseRejection",
    "errorMessage": "Error: write EPROTO",
    "reason": {
        "errorType": "Error",
        "errorMessage": "write EPROTO",
        "code": "EPROTO",
        "errno": -71,
        "syscall": "write",
        "$metadata": {
            "attempts": 1,
            "totalRetryDelay": 0
        },
        "stack": [
            "Error: write EPROTO",
            "    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16)"
        ]
    },
    "promise": {},
    "stack": [
        "Runtime.UnhandledPromiseRejection: Error: write EPROTO",
        "    at process.<anonymous> (/var/runtime/index.js:35:15)",
        "    at process.emit (events.js:400:28)",
        "    at processPromiseRejections (internal/process/promises.js:245:33)",
        "    at processTicksAndRejections (internal/process/task_queues.js:96:32)"
    ]
}

The workaround mentioned about did not work for us

rmclaughlin-nelnet avatar Jul 20 '22 16:07 rmclaughlin-nelnet

This is likely an issue with Node 14 which is now out of support. Please upgrade to node 18.

Thanks, Ran~

RanVaknin avatar Jun 27 '23 22:06 RanVaknin

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

github-actions[bot] avatar Jul 12 '23 00:07 github-actions[bot]