9

I'm currently attempting to deploy a Nuxt SSR app to Firebase.

Everything works correctly on local and the firebase server. The cloud function correctly executes and renders the html, no problem.

The problem happens when I add a request to and external API (Storyblok). I'm on the Blaze plan so external requests should work, right?

Everything works on local using the cloud functions emulator and through firebase serve --only functions,hosting with the external API request but I get an error 500 after deploying.

Is there a way to get a more detailed log of what may be happening on the Firbase end?

Cloud Function:

const functions = require('firebase-functions');
const { Nuxt } = require('nuxt');
const express = require('express');
const app = express();

const config = {
  dev: false,
  buildDir: 'nuxt',
  build: {
    publicPath: '/assets/'
  }
}
const nuxt = new Nuxt(config);

function handleRequest(req, res) {
  res.set('Cache-Control', 'public, max-age=150, s-maxage=150');
  return new Promise((resolve, reject) => {
    nuxt.render(req, res, promise => {
      promise.then(resolve).catch(reject)
    })
  });
}

app.use(handleRequest);
exports.nuxtssr = functions.https.onRequest(app);

2 Answers 2

0

Try to add debug: true in your Nuxt config.

i.e.

const config = {
  debug: true,
  dev: false,
  buildDir: 'nuxt',
  build: {
    publicPath: '/assets/'
  }
}

This will make the error message shows in browser, instead of just error 500.

Sign up to request clarification or add additional context in comments.

Comments

-2

Referring you to :

https://firebase.google.com/docs/functions/writing-and-viewing-logs#viewing_logs

perhaps this would have more details using Using the Firebase CLI.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.