Error 502 (Server Error)!!1
See original GitHub issueEnvironment details
- OS: Debian
- Node.js version: 14
@google-cloud/storage
version: 5.1.1
Steps to reproduce
await googleStorageBucket.upload(transcodedFilePath, {
destination: 'images/' + uid,
gzip: false,
metadata: {
contentType: 'image/webp',
storageClass: 'STANDARD',
},
onUploadProgress: createFileUploadProgressEventHandler(
'transcoded image',
uid,
transcodedFileStat.size,
),
predefinedAcl: 'bucketOwnerFullControl',
resumable: false,
validation: 'crc32c',
});
Occasionally fails with:
statusCode: 502
statusMessage: Bad Gateway
headers:
User-Agent: gcloud-node-storage/5.1.1
x-goog-api-client: gl-node/14.5.0 gccl/5.1.1
Authorization: Bearer [..]
Content-Type: multipart/related; boundary=925dbc29-dd20-4554-b36b-89ebb41850c2
href: https://storage.googleapis.com/upload/storage/v1/b/contrawork/o?uploadType=multipart&name=images%2F0c902ad8-403f-6000-9758-fe7194509706&predefinedAcl=bucketOwnerFullControl
body:
"""
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 502 (Server Error)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>502.</b> <ins>That’s an error.</ins>
<p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds. <ins>That’s all we know.</ins>
"""
There appears to be no built in logic to retry these errors.
I worked around this issue by adding a generic retry wrapper above the googleStorageBucket.upload
function. However, (1) I am still getting many of these errors logged (2) this [retry logic] looks like something that should be handled by @google-cloud/storage
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
502 Bad Gateway - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or ...
Read more >What is a 502 Bad Gateway Error (And How Can I Fix It)?
A 502 Bad Gateway Error means the website you're connected to tried to relay information from another server and encountered an error.
Read more >How To Fix a 502 Bad Gateway Error - Kinsta
The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an...
Read more >502 Bad Gateway Error: What It Is and How to Fix It - Lifewire
The 502 Bad Gateway error is an HTTP status code that means that one server on the internet received an invalid response from...
Read more >How to Solve 502 Bad Gateway Issues? - KeyCDN Support
Usually, a 502 error code is the result of a server error. A server error means that the server you are trying to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @surjikal , Can you please open a new issue with this information and also some more details (such as size of file you’re uploading, file type, frequency of errors, and a small repro snippet)?
Seeing this a bunch since upgrading from 4 to
5.10.0
ECONNRESET
forfile(x).download()
.file(x).createWriteStream({resumable:false})
(I don’t remember why I have resumable = false, I am 99% sure it’s to deal w/ similar issues during writes).I upgraded to 5 because I thought it would help w/ these types of issues, but it seems flakier tbh.