Deployment is returning 502: BAD_GATEWAY error
See original GitHub issueI am trying to sort out what is causing the error. Here is the error from the Build Logs:
12:52:57.034 | ┌──────────────────────────────┐
-- | --
12:52:57.035 | │ built server with 2 warnings │
12:52:57.035 | └──────────────────────────────┘
12:52:57.035 | > 'images/successkid.jpg' is imported by src/routes/index.svelte, but could not be resolved – treating it as an external dependency
12:52:57.035 | > Entry module "src/server.ts" is implicitly using "default" export mode, which means for CommonJS output that its default export is assigned to "module.exports". For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set "output.exports" to either "auto" or "default", otherwise you might want to consider changing the signature of "src/server.ts" to use named exports only.
I am thinking the 2nd error could be the main problem with the deploy. Here is what my server.ts file shows:
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
export default polka() // You can also use Express
.use(
compression({ threshold: 0 }),
sirv('static', { dev }),
sapper.middleware()
)
.listen(PORT, err => {
if (err) console.log('error', err);
});
However, when I run vercel
in the CLI I get this error:
Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply.
I assume that the mentioned “configuration file” is vercel.json. Mine looks like this:
{
"version": 2,
"builds": [
{
"src": "package.json",
"use": "vercel-sapper"
}
]
}
Does anyone have guidance on how to fix the 502: BAD_GATEWAY error I am experiencing? Thank you in advance for any assistance.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (3 by maintainers)
Top Results From Across the Web
How to Fix Kubernetes '502 Bad Gateway' Error - Komodor
A 502 Bad Gateway error is an 5xx server error that indicates a server received an invalid response from a proxy or gateway...
Read more >How to Fix 502 Bad Gateway Error - Hostinger
This article will go over some troubleshooting steps to follow when a 502 Bad Gateway error occurs, both for the server and client-side....
Read more >What is a 502 Bad Gateway and how do you fix it? - IT PRO
An Error 502 Bad Gateway means there is a problem with the website's server, rather than your computer, router, or internet connection. It's...
Read more >502 Bad Gateway Error: What It Is and How to Fix It
As mentioned, a 502 Bad Gateway Error means the client is having difficulty connecting to a server. This means that the server creating...
Read more >trying to debug "502 Bad Gateway" error after deploying react ...
"An error code 502 with BAD_GATEWAY in the message usually indicates that App Engine terminated the application because it ran out of memory....
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 FreeTop 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
Top GitHub Comments
unfortunately this didn’t help.
I think the
.vercelignore
blocks the upload ofsrc/node_modules
This change could fix it: