Angular 19 SSR cloud functions ESM build
- Dominant language
- TypeScript
- Stars
- 7.8k
- Forks
- 2.2k
- Avg merge
- 22h 28m
- Merged PRs (30d)
- 6
Description
- [ ] unable to serve/deploy ssr functions esm build artifacts with vanilla cloud functions
- [x] able to ng serve, ng build (build-angular:application), and node ./server.mjs
- [x] other functions unrelated to SSR are working (server backend) as intended
Heres my SSR setup:
universal.ts
```typescript
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
```typescript
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 = `
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
Contributor guide
Research direction
Start with universal.ts and render.js, then reproduce the reported difference between ng build (build-angular:application), node ./server.mjs, and deployment of the SSR functions. Inspect the generated dist/stamp-app/server/server.mjs and browser artifacts alongside the vanilla Cloud Functions setup. Done means the SSR function serves and deploys successfully with the ESM build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, express, firebase, node.js, typescript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 43/100