nuxt: Need better way to logs error on Server Error page?

All I get is the below image, nothing else.

How can I know what went wrong?

screen shot 2017-11-08 at 2 55 01 pm

The following is my setup.

const cors = require('cors')({ origin: true })
const express = require('express')
const functions = require('firebase-functions')
const fs = require('fs')
const path = require('path')
const { Nuxt } = require('nuxt')

const nuxtDir = path.resolve('.', 'nuxt')
if (fs.existsSync(nuxtDir)) {
  console.log('Nuxt directory exists.', nuxtDir)
} else {
  console.error('Nuxt directory does not exists.', nuxtDir)
}

const app = express()
const nuxt = new Nuxt({ dev: false, buildDir: 'nuxt' })

app.use(cors)
app.use(nuxt.render)

exports.render = functions.https.onRequest(app)

It works if i run firebase serve --only functions,hosting locally But doesn’t when i deploy it to firebase and show the above image.

<div align="right">This question is available on Nuxt.js community (#c1816)</div>

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 21 (2 by maintainers)

Most upvoted comments

Please don’t close this issue, debug: true is not a good solution because shows the error at the browser, we need an way to see the log without exposing the code!

Please don’t close it. There is still a need to send the logs to a file instead of having to use module.exports = { debug: true } to show them on the website itself.

@pi0 I’m pinging this thread again. This is a really important feature. Even today I had unexplained errors for users and there is no way for me to check. It says “check the logs” but there are no logs and I can’t expose debug to true in production, that’s a horrible solution

I also addressed the same problem. adding the following code to nuxt.config.js, we were able to display error details in production( or staging project) as well. @atmar thanks for the example! ( not native english 😃 )

process.env.DEBUG = 'nuxt:*'

module.exports = {
  debug: true,
...
error

In my case, I am getting better by adding a module.

yarn add regenerator-runtime
yarn add core-js
...
firebase deploy