vercel: Vercel deploy fails, reason: socket hang up

Vercel CLI failed while trying to deploy the app.

Even though the app continue to build and deploy on vercel, with a sequence of staging deploys queue.

Command:

npx vercel

Output:

Vercel CLI 23.1.2
Error! request to https://api.vercel.com/v13/now/deployments?teamId=team_***  failed, reason: socket hang up

Result:

screenshot

Expected: no errors, 1 deploy.

Platform: Linux Vercel CLI version: 23.1.2

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (1 by maintainers)

Most upvoted comments

Here is part of the response I got from Vercel regarding the aforementioned error:

Socket hang up can happen when too many files are being pushed to Vercel, hitting the API limit threshold or the internet connection itself is poor and the connection is dropped. Typically when we’ve seen it, it’s been caused by the nodes_modules and the .git folders being uploaded to Vercel, which aren’t required for the build.

I was not able to identify any such large folders or internet issues, so I tried what @GiancarlosIO proposed by adding --archive=tgz and it worked! Here is what our uploading script looks like:

vercel pull --yes --environment=production --token=$VERCEL_TOKEN
vercel build --prod --token=$VERCEL_TOKEN
vercel deploy --prebuilt --prod --archive=tgz --token=$VERCEL_TOKEN

I’m also experiencing this issue with Vercel CLI 25.1.0.

@ivstiv I was getting the same error. To fix that I switched to vercel deploy --prebuilt --archive=tgz Now, we run the following commands in our gitlab runner to deploy our nextjs apps:

  • vercel pull
  • vercel build
  • vercel deploy --prebuilt --archive=tgz

Related discussion: https://github.com/vercel/vercel/discussions/8643

I’m having the exact same issue, it hangs for a while and then errors out with failed, reason: socket hang up. Anyone found a fix?

Hi @GiancarlosIO @TooTallNate. I did not do anything, It just simply started working as it should after a few days… 😅

I turned on the VPN and everything worked

Why the option --archive=tgz option is not on Vercel’s CLI help? 🤔

hi @vinisaveg @TooTallNate, How did u solve that error? I’m getting the same error For some reason the command vercel -t my-token fails with a failed, reason: socket hang up. This error happens in our GitLab ci (and also in local). The other thing is that I don’t get why 6-7 deployments are created when we run vercel -t my-token only one time.