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);