Patrickkx
Patrickkx

Reputation: 1870

How to check if google cloud function responsible for SSR runs?

I have some code responsible for SSR:

import React from 'react';
import { renderToString } from 'react-dom/server';
import express from 'express';
import fs from 'fs';
import App from './app/containers/App';

const app = express();

app.get('**', (req, res) => {
  const html = renderToString(<App />);
  res.set('Cache-Control', 'public, max-age=600, s-maxage=1200');
  res.send(html);
});

export const ssrapp = functions.https.onRequest(app);

And it should of course fail. I mean - it should just show plain html text from App when entering my app hosted on firebase. However - it doesn't happen. My app just loads as it used to (it shows everything - not just the html text).

My question: How to check if that ssrapp google cloud function even runs? I tried to use some console.log inside it, however no logs are visible.

Upvotes: 0

Views: 39

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317372

The Firebase console will show log messages for each function invocation, regardless if you logged anything with console.log(). If you see nothing in the log, then your function is not running (or the console is temporarily broken).

Upvotes: 1

Related Questions