Open
Description
- unable to serve/deploy ssr functions esm build artifacts with vanilla cloud functions
- able to ng serve, ng build (build-angular:application), and node ./server.mjs
- other functions unrelated to SSR are working (server backend) as intended
Heres my SSR setup:
universal.ts
import { onRequest } from 'firebase-functions/v2/https'; import { render } from '../../render.js'; import express, { Request, Response, NextFunction } from 'express'; import * as server from '../../../dist/stamp-app/server/server.mjs'; export const ssrApp = express() as any; ssrApp.use(express.static('dist/stamp-app/browser')); ssrApp.get('*', async (req: Request, res: Response, next: NextFunction) => { const ssr: any = await render(server, req, res, next); res.send(ssr); }); export const universal = onRequest( { maxInstances: 10, timeoutSeconds: 1200, cpu: 1, memory: '2GiB', region: ['us-central1'] }, ssrApp );
render.js
import { Request, Response, NextFunction } from "express"; export async function configServerApp(app: any, req: Request, res: Response, next: NextFunction) { //configure app here & retrieve HTML let template; if (req.path === '/') { // template = await fetch('@dist/stamp-app/browser/index.csr.html'); next(); } template = `<div>HTML CONTENT FOR SSR APP</div>`; return template; } export async function render(app: any, req: Request, res: Response, next: NextFunction) { const ssrApp = await configServerApp(app, req, res, next); return ssrApp; }
am I missing something..? thanks for any help in advance
Metadata
Metadata
Assignees
Labels
No labels