Skip to content

Commit 871b7bd

Browse files
authored
handle cloudflare 520 errors for file upload (#776)
* handle cloudflare 520 errors for file upload * 503 too
1 parent ece88c5 commit 871b7bd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/deploy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ class DeployBuildEffects implements BuildEffects {
350350
try {
351351
await this.apiClient.postDeployFile(this.deployId, sourcePath, outputPath);
352352
} catch (error) {
353-
if (isHttpError(error) && error.statusCode === 413) {
353+
// 413 is "Payload Too Large", however sometimes Cloudflare returns a
354+
// custom Cloudflare error, 520. Sometimes we also see 502. Handle them all
355+
if (isHttpError(error) && (error.statusCode === 413 || error.statusCode === 503 || error.statusCode === 520)) {
354356
throw new CliError(`File too large to deploy: ${sourcePath}. Maximum file size is 50MB.`, {cause: error});
355357
}
356358
throw error;

0 commit comments

Comments
 (0)