amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

amplify push timeout: An error occured during the push operation: Your socket connection to the server was not read from or written to within the timeout period

Open andreialecu opened this issue 6 years ago • 50 comments

Describe the bug

For the past few days, as the schema started growing it has been almost impossible to reliably push any changes via amplify push --yes

The "Updating resources in the cloud. This may take a few minutes..." message only appears for one in several push attempts.

Some more logs/status updates relating to what it does at every step between compiling the schema and updating the resources in the cloud would be helpful.

I'm not sure if it's some sort of intermittent outage related to S3 or other resources amplify push might be using. This is not an internet problem on my end.

Running amplify api push results in a stack trace that mentions S3 as the reson for the timeout.

I have attached a screenshot below.

Error is: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed. An error occured during the push operation: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

Amplify CLI Version

4.18.0

Expected behavior

Pushing should not timeout.

Screenshots

image

Desktop (please complete the following information):

node -v: 13.7.0 Win10 with WSL2 (Ubuntu)

Additional context

This started happening yesterday, presumably related to schema changes but I'm not sure. The processing step before it starts "Updating resources in the cloud. This may take a few minutes..." has been taking longer and longer.

Has been reported several times but the issues are closed:

https://github.com/aws-amplify/amplify-cli/issues/462 https://github.com/aws-amplify/amplify-cli/issues/501 https://github.com/aws-amplify/amplify-cli/issues/2121

andreialecu avatar Apr 29 '20 10:04 andreialecu

Here's a screenshot of the error during amplify function push --yes:

image

andreialecu avatar Apr 29 '20 10:04 andreialecu

Here's another screenshot of having to run the command 3 times:

image

andreialecu avatar Apr 29 '20 10:04 andreialecu

@andreialecu This usually happens when Lambda sizes are too large, what's the size of your Lambda package that you are trying to deploy?

ammarkarachi avatar Apr 29 '20 17:04 ammarkarachi

The size of the zip in the dist directory of the function is 1.5 megabytes.

It's this big because of node_modules dependencies. The unpacked size is around 6-7 MB.

andreialecu avatar Apr 29 '20 17:04 andreialecu

@andreialecu I have been unable to reproduce it but as far as I know there could be a problem with the network. When a packet loss occurs S3 waits on the packet to be resent and waits, if the packets aren't sent in 20 seconds the connection is closed. I would recommend checking the network connection on the machine you are using to publish.

ammarkarachi avatar May 04 '20 16:05 ammarkarachi

image

This issue is present in Amplify version 4.22 going forward.

KayIlory avatar Jul 08 '20 11:07 KayIlory

amplify cli 4.24.3 does not work for me, error same as this issue. I downgraded to @aws-amplify/[email protected], it works as for now.

bernardnongpoh avatar Jul 22 '20 19:07 bernardnongpoh

Same for me, with @aws-amplify/[email protected]. In my network connection there are some retransmissions due to signal quality. Uploading files to S3 through web console works, but if I try to use amplify push always get a socket timeout.

ilfoxo avatar Jul 28 '20 14:07 ilfoxo

@ammarkarachi - how are you.. is it safe to say this has now been resolved. Or maybe being tracked by another issue reference

KayIlory avatar Sep 14 '20 15:09 KayIlory

@KayIlory This should be available in the latest build let me know if it works for you.

ammarkarachi avatar Sep 14 '20 19:09 ammarkarachi

Still happening to me in version 4.35.0. Command stuck at \ Uploading Files...8% and fails with socket timeout error

Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
An error occurred during the push operation: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

while pushing a lambda trigger function. It uses npm package node-html-to-image and hence it becomes a little bulky.

vidhyasagarj avatar Nov 27 '20 05:11 vidhyasagarj

Still happening - why is this closed?

Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
An error occurred during the push operation: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

Version: @aws-amplify/[email protected]

amcdnl avatar May 24 '21 13:05 amcdnl

This is indeed still happening, I can no longer push with 4.52.

This is not an internet problem.

TheDutchCoder avatar Jun 09 '21 21:06 TheDutchCoder

So I was able to figure out what the issue was ....

  • Amplify Push
  • Connections Opened ( S3/etc )
  • Amplify Build + Your Build
  • Build > S3 Socket Timeout time = Failure

amcdnl avatar Jun 10 '21 11:06 amcdnl

+1. Also running into this. My feel is perhaps I have too many lambdas and too big of packages in each lambda for upload. I deploy through AWS Amplify as workaround. Perhaps the ongoing lambda layers rework will finally allow me to use lambda layers in the way I want.

hisham avatar Jun 13 '21 20:06 hisham

Downgraded to @aws-amplify/[email protected] and it works! as @bernardnongpoh said

stevenbdf avatar Jun 15 '21 00:06 stevenbdf

This is a pretty big issue since you are not able to deploy any complex app that has large set of changes.

amcdnl avatar Jun 16 '21 20:06 amcdnl

I have not been able to reproduce this even with very large lambdas with a lot of dependencies. Does anyone have complete reproduction steps by any chance? Perhaps a repo that is affected by this?

johnpc avatar Jun 18 '21 20:06 johnpc

@johnpc - Make complex gql complile + codegen + builds amplify:typescript take >15s.

amcdnl avatar Jun 21 '21 11:06 amcdnl

I tried using "amplify:[functionName]": "echo [functionName] > /tmp/tmp.txt && sleep 20 && echo done > /tmp/tmp.txt" and saw that the step completed before the upload was initiated and the push was successful.

johnpc avatar Jun 21 '21 17:06 johnpc