HTTP 408 request timeouts deploying site as ZIP using API

Hi. When I deploy a site as a ZIP file, I’m getting request timeouts — most of the time. Once in a while, it works, but rarely. I get the same result with PUT and PATCH. Deploy works when I drag the ZIP file onto the deploy page. I’ve only just started using the API to deploy, so I can’t say if this is new behaviour.

I’d appreciate some help here, thanks.

> curl --retry 5 -vH "Content-Type: application/zip" \
-H 'Authorization: Bearer [BEARER_REMOVED]' \
--data-binary "@build/build.zip" \
https://api.netlify.com/api/v1/sites/602d845d06370a4f4a5c5523--hire123.netlify.app/deploys
[…]
> POST /api/v1/sites/602d845d06370a4f4a5c5523--hire123.netlify.app/deploys HTTP/2
> Host: api.netlify.com
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/zip
> Authorization: Bearer [BEARER_REMOVED]
> Content-Length: 171324
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
* We are completely uploaded and fine
< HTTP/2 408
< content-type: text/html; charset=UTF-8
< referrer-policy: no-referrer
< content-length: 279
< date: Wed, 17 Feb 2021 21:48:03 GMT
< alt-svc: clear
<
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>408 Request Timeout</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Request Timeout</h1>
<h2>Your client has taken too long to issue its request.</h2>
<h2></h2>
</body></html>

When I PUT or PATCH, I use the API URL without the trailing ‘/deploys’, eg.

> curl --retry 5 -X PUT -vH "Content-Type: application/zip" \
-H 'Authorization: Bearer [BEARER_REMOVED]' \
--data-binary "@build/build.zip" \
https://api.netlify.com/api/v1/sites/602d845d06370a4f4a5c5523--hire123.netlify.app
[…]
> PUT /api/v1/sites/602d845d06370a4f4a5c5523--hire123.netlify.app HTTP/2
> Host: api.netlify.com
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/zip
> Authorization: Bearer [BEARER_REMOVED]
> Content-Length: 171324
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
* We are completely uploaded and fine
< HTTP/2 408
< content-type: text/html; charset=UTF-8
< referrer-policy: no-referrer
< content-length: 279
< date: Wed, 17 Feb 2021 22:06:18 GMT
< alt-svc: clear
<
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>408 Request Timeout</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Request Timeout</h1>
<h2>Your client has taken too long to issue its request.</h2>
<h2></h2>
</body></html>

FYI, MacOS’s curl is likely to blame for this behaviour. I ran the command on another machine with success. After brew installing curl, that version worked fine. Here’s version output for both, in case anyone runs into this problem again:

> /usr/bin/curl --version            
curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets

> /usr/local/opt/curl/bin/curl --version
curl 7.75.0 (x86_64-apple-darwin20.2.0) libcurl/7.75.0 (SecureTransport) OpenSSL/1.1.1i zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.0 libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2021-02-03
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz Metalink MultiSSL NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets zstd

Super interesting! Thanks so much for reporting.

1 Like