All of a sudden netlify-deploy throws the following error Warning: TextHTTPError: 502 Bad Gateway

Really not sure what’s going on here. I tried upgrading the cli, clearing cache, etc. Running netlify deploy --prod up to this point has worked fine, but now I keep getting the following:

$ netlify deploy --prod
Deploy path:        /Applications/MAMP/htdocs/mysite/netlify-production
Functions path:     /Applications/MAMP/htdocs/mysite/inc
Configuration path: /Applications/MAMP/htdocs/mysite/netlify.toml
Deploying to main site URL...
✔ Finished hashing 1 files and 18 functions
✔ CDN requesting 0 files and 17 functions
↖️  (16/17) Uploading sf-venue... ›   Warning: TextHTTPError: 502
 ›   Warning: 
 ›   TextHTTPError: Bad Gateway
 ›
⬆️  (16/17) Uploading sf-venue...TextHTTPError: Bad Gateway
    at parseResponse (~/.nvm/versions/node/v13.2.0/lib/node_modules/netlify-cli/node_modules/netlify/src/methods/response.js:12:11)
    at runMicrotasks (<anonymous>)
    at async callMethod (~/.nvm/versions/node/v13.2.0/lib/node_modules/netlify-cli/node_modules/netlify/src/methods/index.js:38:26)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The only thing that has changed since the last successful deploy is the custom domain I am using for my site on netlify. Other than that I’m not sure where to go with this. I found some similar threads out there but nothing that seems to help with this. Any ideas?

Hey all, so this has something to do with attempting to require puppeteer in one of my functions. While attempting deploy from github branch instead of the CLI, I received an error that it could not find a module required by puppeteer. After correcting that my deploy was able to get further along in the process, but now I am getting the follow:

9:30:34 AM: Build script success
9:30:34 AM: Starting to deploy site from './public/'
9:30:35 AM: Creating deploy tree 
9:30:36 AM: Creating deploy upload records
9:30:36 AM: 49 new files to upload
9:30:36 AM: 1 new functions to upload
9:32:45 AM: Failed to upload file: prerender
9:32:45 AM: Failing build: Failed to deploy site
9:32:45 AM: failed during stage 'deploying site': Failed to execute deploy: [PUT /deploys/{deploy_id}/functions/{name}][500] uploadDeployFunction default  &{Code:0 Message:}
9:32:45 AM: Finished processing build request in 7m34.280971675s

The prerender file is the one that requires puppeteer. Not really able to decipher the mystery here, is there a way to further debug?

Howdy @kmcaloon! Mind linking us to your deploy logs in our UI? That’ll let us correlate with internal logs to discover the problem. I have ideas but ability to see the logs myself, will make it a sure thing :slight_smile:

Just sent you the link. Thanks for your help!

For future reference, please post publicly - I don’t see DM’s very quickly and thus our team was unable to help you since you only sent it to once person who was out of the office :slight_smile:

So I took a look at our internal logs and it is the “prerender” function that is failing to upload. Seems it is too large; needs to be under 70Mbyte zipped and that is larger.

Ahh got it. Thanks for clearing it up!

1 Like

Sorry to bother again, but this is happening again but this time I don’t seem to have any large package that I know of. Would really help if the CLI or logs gave more details here. Here is the log of my most recent deploy which returned another “Bad Gate” error in the CLI: https://app.netlify.com/sites/condescending-booth-644542/deploys/5ec6d6b84499f39c89724e79

Bad gateway will mean the deploy has failed. This bug is likely the one that will need a fix, to remove those errors: https://github.com/netlify/cli/issues/745

Until then, I’d try building from Git.

Ok, I’ll avoid deploying from the CLI for the time being. Thanks again.

1 Like