I have deployed a Rendertron instance on GCP (https://rendertron-creatillo.ey.r.appspot.com/)
And set up my middleware as a Cloud Function on Firebase as described here: https://github.com/justinribeiro/pwa-firebase-functions-botrender
When I run it through Google's mobile friendly test page (https://search.google.com/test/mobile-friendly) I get these errors in the log:
2022-08-23T15:49:48.486178Zappi83gp1p4qz98 Unhandled rejection
Error
2022-08-23T15:49:48.490217Zappi83gp1p4qz98 FetchError: redirect location header missing at: https://rendertron-creatillo.ey.r.appspot.com/render/http://creatillo.com/post/how-its-made-hurth-6-march-2208 at ClientRequest.<anonymous> (/workspace/node_modules/node-fetch/index.js:152:13) at ClientRequest.emit (events.js:203:15) at ClientRequest.EventEmitter.emit (domain.js:466:23) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21) at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17) at TLSSocket.socketOnData (_http_client.js:451:20) at TLSSocket.emit (events.js:198:13) at TLSSocket.EventEmitter.emit (domain.js:466:23) at addChunk (_stream_readable.js:288:12) at readableAddChunk (_stream_readable.js:269:11)
Debug
2022-08-23T15:49:48.495068257Zappi83gp1p4qz98 Function execution took 11324 ms. Finished with status: crash
Error
2022-08-23T15:49:48.581883Zappi83gp1p4qz98 Error: Process exited with code 16 at process.on.code
And the test results in this: URL is not available to Google. It cannot be tested.
What seems strange to me is that a http url is being fetched by Rendertron in these cases, though I'm not sure that's the issue.
I've tried to look for what these GCP error messages stand for, but hadn't run into a similar situation.
Code served for crawlers:
app.get('*', (req, res) => {
const botResult = checkForBots(req.headers['user-agent']);
if (botResult) {
const targetUrl = generateUrl(req);
fetch(`${FIREBASE_CONFIG.rendertron.server}/render/${targetUrl}`)
.then(function(res) {
return res.text();
}).then(function(body) {
res.set('Cache-Control', 'public, max-age=300, s-maxage=600');
res.set('Vary', 'User-Agent');
res.send(body.toString());
});
} else {
res.send(pwaShell());
}
});