angular / angular/angularfire

Angular 19 SSR cloud functions ESM build

オープン
#3,645 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
7.8k
フォーク
2.2k
平均マージ
22時間 28分
マージ済み PR(30日)
6

説明

- [ ] 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 = `

HTML CONTENT FOR SSR APP
`;
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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

universal.ts と render.js から始め、ng build (build-angular:application)、node ./server.mjs、SSR functions のデプロイ間で報告された差異を再現します。生成された dist/stamp-app/server/server.mjs とブラウザーのアーティファクトを、vanilla の Cloud Functions セットアップと併せて調査します。ESM build で SSR function が正常にリクエストを処理し、デプロイできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, express, firebase, node.js, typescript
領域
backend, cloud
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
43/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。