-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Cloud Deployment #344
Comments
I'm having the same issue. I'm deploying with gcloud and after update completes the page shows the error 502
That's happining with the "starter" template, with no modifications. |
@tomasleiva9 The app engine has an integrated health check feature, which asks your service periodically whether its alive or not. Using the nuxt cli for starting won't be enough, you have to use the express middleware to be able to add a new endpoint for the health check. This is my code for the express server: const Nuxt = require('nuxt')
const app = require('express')()
const host = process.env.HOST || '0.0.0.0'
const port = process.env.PORT || 8080
app.set('port', port)
// Import and Set Nuxt.js options
let config = require('./nuxt.config.js')
config.dev = !(process.env.NODE_ENV === 'production')
// GCloud Health Check
app.get('/_ah/health', (req, res) => {
res.status(200)
res.send()
})
// Init Nuxt.js
const nuxt = new Nuxt(config)
app.use(nuxt.render)
// Build only in dev mode
if (config.dev) {
nuxt.build()
.catch((error) => {
console.error(error) // eslint-disable-line no-console
process.exit(1)
})
}
// Development error handler
if (app.get('env') === 'development') {
app.use((err, req, res) => {
res.status(err.status || 500)
res.render('error', {
message: err.message,
error: err
})
})
}
// Production error handler
app.use((err, req, res) => {
console.log(err)
res.status(err.status || 500)
res.render('error', {
message: err.message,
error: {}
})
})
// Listen the server
app.listen(port, host)
console.log('Server listening on ' + host + ':' + port) // eslint-disable-line no-console |
Perfect @John0x . It worked very well. I found more information about this in documentation from Vuejs, if someone else need more help... |
Adding on to here that, even after disabling health check, i still get 502 Bad Gateway not sure what the cause is |
@sqram Did you set the port 8080 (app engines uses that port) |
hello @John0x
|
@Reworking i did. i tried many other things as well. Eventually gave up and went fully restful :( |
Would someone here be so kind and post a github link to a full working project (i.e. where you can clone, yarn, and run gcloud app deploy and it works) ? I tried applying numerous solutions from here and stack overflow on top of the simplest project from template https://github.com/nuxt-community/express-template and still cannot get it to work :( |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hey, I'm having issues to deploy my nuxt based application in the google cloud.
The logs are fine, but the website doesn't work at all.
Has anyone attempted to deploy nuxt to gcloud?
The text was updated successfully, but these errors were encountered: